#database #development #eloquent #laravel #php

The model class has a method called freshTimestamp. It will return a new Carbon timestamp with the current date and time. The same method is used for setting the created_at and updated_at fields inside your model. You can use this method inside your own code if you wish.

1$book = new Book();
2$book->title = 'The world of Pringles';
3$book->published_at = $book->freshTimestamp();