80790/how-to-only-use-created-at-in-laravel
This can custom timestamps name
const CREATED_AT = 'created'; const UPDATED_AT = 'updated';
This can disable timestamps
public $timestamps = false;
I want only use created_at , how to do it?
Hello @kartik,
Eloquent does not provide such functionality out of the box, but you can create it on your own using the creating event callback:
class User extends Eloquent { public $timestamps = false; public static function boot() { parent::boot(); static::creating(function ($model) { $model->created_at = $model->freshTimestamp(); }); } }
Hope it helps!! Thank you!!
Hii, You can create a constants.php page in config folder ...READ MORE
Hello @kartik, Laravel has inbuilt support for multiple ...READ MORE
Hello @kartik, You call it by http://localhost:8080/api/test ...READ MORE
Hello @kartik, You can use relations as query ...READ MORE
Hey @kartik, First you have to go to ...READ MORE
Named route is used to give specific ...READ MORE
Hello, This is simple you just need to ...READ MORE
Hey @kartik, Named routing is another amazing feature of ...READ MORE
Hey, To create a Stored Procedure you can ...READ MORE
Hello, Laravel provides a powerful and clean API ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.