I am new to laravel. Recently, I have created my ER diagram for my app. While learning laravel I see that they have this timestamp property in the schema builder that creates a created_at and updated_at column. Base on my modeling I don't really need these extra columns, so it's a must to have them or what are the benefits of having these columns on every table.
A benefit for having them, in cases where you need them, is that Eloquent will automatically update these fields. So lets say you update a model, Eloquent will automatically set the updated_at, leaving you with less code to write, maintain and think about.
As it is not a requirement to have these timestamps on every table, you can simply disable them by using public $timestamps = false;
on the related model as such:
class User extends Eloquent {
protected $table = 'users';
public $timestamps = false;
}
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