Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What type of column should I use for created_at and modified_at in Laravel Eloquent 2?

Should I use DATETEIME? or INT?

Thanks!

EDIT: I'm specifically addressing the

public static $timestamps = true; 

flag set in Eloquent models.

like image 565
brennanag Avatar asked Sep 06 '12 08:09

brennanag


2 Answers

Laravel only supports datetime for their timestamps.

https://github.com/laravel/laravel/pull/769

like image 125
Jürgen Paul Avatar answered Sep 22 '22 20:09

Jürgen Paul


Just as an update: Mich's answer is still valid for Laravel 3 and below,

but as of Laravel 4, it switched to supporting timestamp columns for created_at and updated_at.

Here's a related issue on GitHub

like image 45
FireSBurnsmuP Avatar answered Sep 21 '22 20:09

FireSBurnsmuP