lara-dom
1 month ago
338
11
Laravel

Laravel 7 timestamp migration always return 0000-00-00 00:00:00 when importing a csv excel file

Posted 1 month ago by lara-dom

I search all the related article but no solution. I was setting up a sitemap for laravel when I realise the timestamp is not ok. So this is bad for seo.

I always have those 0 in the created_at and updated_at field in my sql database.

I'm not sure if it's a laravel, sql or excel question.

What I do:

  • migrate my table in laravel in my localhost $table->timestamps(); tried this also but no
            $table->timestamp('created_at')->useCurrent();
            $table->timestamp('updated_at')->useCurrent();
            $timestamps = false;
            $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
  • I import the sql database in the server phpmyadmin from my localhost

  • And import the excel csv file in phpmyadmin with the data but with nothing.

Maybe there's another ways to properly do this?

Thnaks for any help somebody can give me.

Please sign in or create an account to participate in this conversation.