I have just started using Laravel 5 and I have problem with timestamps. When I seed a table, everything going good and I get e.g.
created_at
"2015-04-04 20:02:21"
updated_at
"2015-04-04 20:02:21"
But when i use Order::insert(array())
i get:
created_at
"0000-00-00 00:00:00"
updated_at
"0000-00-00 00:00:00"
In laravel 4 I need not set timestamps manually, so I believe, I need not do it there too.
As I can see you're using Eloquent. Instead of using insert() method you should create new record in DB like this:
$order = new Order;
$order->save();
In this case Eloquent will maintain the created_at and updated_at columns on your database table automatically
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With