Reputation: 1458
I am working on Laravel 4 application and would like to save the unix timestamp for the created_at and updated_at fields instead of the default timestamp values.
Any suggestions on how I could achieve this?
Regards,
Upvotes: 10
Views: 19084
Reputation: 100175
you can just get the timestamp property, as:
$timestamp = $model->created_at->timestamp;
or, you could override the getDateFormat(), and create migration of required fields, as:
$table->integer('created_at');
$table->integer('updated_at');
Upvotes: 18