We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
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.
$book = new Book();
$book->title = 'The world of Pringles';
$book->published_at = $book->freshTimestamp();
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.