Controllers Auto-Return JSON from Eloquent
Pass a raw query to order your results
Load data completed between two timestamps
Load data faster when the targeted value is an integer
New `rawValue()` method since Laravel 9.37
Eloquent scopes inside of other relationships
You can write transaction-aware code
Perform operation without modifying updated_at field
Merging eloquent collections
Small cheat-sheet for using Full-Text Search with Laravel on MySQL
Remember to use bindings in your raw queries
Column name change
Model all(): Specify Columns
Eloquent where date methods
Increments and decrements
No timestamp columns
Soft-deletes: multiple restore
To Fail or not to Fail
Change Default Timestamp Fields
Quick Order by created_at
No Need to Convert Carbon
Clone Query to Re-Use It
Map query results
Automatic Column Value When Creating Records
DB Raw Query Calculations Run Faster
More than One Scope
Grouping by First Letter
Never Update the Column
Find() Many instead of whereIn()
Find Many and return specific columns
Find by Key
Use UUID instead of auto-increment
Sub-selects in Laravel Way
Hide Some Columns
Exact DB Error
Soft-Deletes with Query Builder
Good Old SQL Query
Use DB Transactions
Update or Create
Forget Cache on Save
Change Format Of Created_at and Updated_at
Storing Array Type into JSON
Make a Copy of the Model
Reduce Memory
Force query without $fillable/$guarded
3-Level Parent-Children: with() and withCount()
firstOr(): Perform any action on failure
Check if record exists or show 404
Abort if condition failed
Fill a column automatically while you persist data to the database
Extra information about the query
Using the doesntExist() method in Laravel
Trait that you want to add to a few Models to call their boot() method automatically
Don't use count() if you can use exists()
withDefault(): Prevent “property of non-object” error
Get original attributes after mutating an Eloquent record
A simple way to seed a database
The crossJoinSub method of the query constructor
Belongs to Many Pivot table naming
Order by Pivot Fields
Find a single record from a database
Automatic records chunking
Updating the model without dispatching events
Periodic cleaning of models from obsolete records
Immutable dates and casting to them
The findOrFail method also accepts a list of ids
Prunable trait to automatically remove models from your database
withAggregate method
Date convention
Eloquent multiple upserts
Retrieve the Query Builder after filtering the results
Custom casts
Order based on a related model's average or count
Return Database Transactions Result
Remove several global scopes from query
Order JSON column attribute
Get single column's value from the first result
Check if altered value changed key
Laravel 8+: New way to define accessor and mutator
Custom Cases instead of accessors and mutators
When searching for the first record, you can perform some actions
Directly convert created_at date to human readable format
Ordering by an Eloquent Accessor
Check for specific model was created or found
Laravel Scout with database driver
Make use of the value method on the query builder
Pass array to where method
Return the primary keys from models collection
Force Laravel to use eager loading
Make all your models mass assignable
Hiding columns in select all statements
JSON Where Clauses
Get all the column names for a table
Compare the values of two columns
Accessor Caching
New scalar() method
Select specific columns
Chain conditional clauses to the query without writing if-else statements
Want More In-Depth Content?
These tips are just the beginning. Get access to full Eloquent courses with video lessons, real-world examples, and hands-on projects.