Laravel replicate(): Duplicate Eloquent Models Safely
"Duplicate this" buttons look easy: copy the row, save it, done. Then the first copy fails with a...
Tag
15 articles
"Duplicate this" buttons look easy: copy the row, save it, done. Then the first copy fails with a...
The easiest Laravel API is one line: return User::all();. Eloquent turns the models into JSON for you. That...
Some Laravel features are famous, and some sit in the docs for years while people write the same...
You create a model, and one of its columns is calculated by the database: a full name built...
Most Laravel apps talk to one database and never think about connections. Then a reporting database shows up,...
Every Laravel model quietly fills in created_at and updated_at, and most of the time that is exactly what...
When a Laravel page or job feels slow, the database is the first suspect, and usually the right...
Create a new Eloquent model, ask for $flight->delayed, and you get null. Not false, even if your database...
Open your app and look at the address bar. If it says /orders/1042, anyone can try /orders/1043. They...
A list endpoint looks trivial until it meets real traffic: someone requests per_page=1000000, a client pages through a...
Use Eloquent when you are working with individual records that have behavior: validation rules, casts, relationships, events, soft...
The Laravel N+1 query problem is the most common reason a page that was fast with ten rows...
We use cookies to improve your experience and analyze traffic. By continuing, you agree to our Privacy Policy.