What are the benefits of the created_at and updated_at column in Laravel

I am new to laravel. I recently created an ER diagram for my application. Studying laravel, I see that they have this timestamp property in the schema builder that creates the created_at and updated_at columns. Based on my modeling, I really don't need these extra columns, so they should have them or what are the benefits of having these columns in each table.

+4
source share
3 answers

The advantage of having them when you need them is that Eloquent will automatically update these fields. So let's say that you are updating the model, Eloquent will automatically set update_at, leaving you with less code to write, maintain and think about.

Since for each table there is no need to have these timestamps, you can simply turn them off using public $timestamps = false;in the corresponding model as such:

class User extends Eloquent {

    protected $table = 'users';

    public $timestamps = false;

}
+4
source

, , ​​. . , , . , created and updated at, public $timestamps = false .

+1

?

, , $table->timestamps() Schema::table() Schema::create(), , , , protected $timestamps = false;

Laravel?

- , , ( ), created_at updated_at , , , .

, Laravel , " Eloquent Model" .

, Laravel, , , .

0

All Articles