Usually during testing, you may want to create a record using a model without dispatching events.
Need to inspect the query being used by Eloquent? Here's how to reveal it.
If you want to exclude the created_at and updated_at columns from a table and disable them in your Eloquent models, here's how.
Added in Laravel 11, incrementOrCreate is a method to create a record uniquely based on a pre-defined array.
This mass assignment error is a really common one when working with Laravel. Here's how to fix the inability to insert/update records.
If you have a potentially existing record and need to update it if it exists or create it if it doesn't. Here's how!
In this article, I'll show you how to set up casts for pivot table columns in your Laravel relationships.
There are several ways to get the row count from your database with Eloquent in Laravel. Let's cover the basics and then look at a much better solution when counting on related models — using aggregates at the database level.
Laravel doesn't have built-in support to fetch next and previous records, but adding a couple of helper methods to your model does the trick.
Ordering in Laravel is pretty straightforward, but you can use a few other techniques to make the most of Eloquent's ordering abilities. Let's cover everything you should know about ordering queries with Laravel!