Its a common problem. It’s most likely because you use query builder to insert your records. The created_at and updated_at will only automatically be inserted if you are using eloquent model.

You can still use query builder but you have to first insert the Carbon package and then use the now method like this:

use Carbon\Carbon;
use Illuminate\Support\Facades\DB;

DB::table(‘name’)-> insert([
‘created_at’ => Carbon::now(),
‘updated_at’ => Carbon::now()