Skip to content

Top 20 Mistakes Laravel Developers Make

Insights•
November 30, 2026

Introduction

Most Laravel codebases I get called into rot the same way. The framework makes it easy to ship on day one, then charges for the shortcuts once a second caller, a second screen, or a second developer shows up. These are the twenty habits I find in almost every project I touch, grouped by category.

This page is the index. Each item is the headline. The four deep dives carry the argument and the code for each category, and the Laravel Best Practices: Writing Laravel That Lasts course fixes all twenty in one reservation system, lesson by lesson, each lesson picking up the code where the previous one stopped. If you are triaging a codebase, scan the headlines; the ones you recognise point at the deep dive to read first and the lesson to work through.

Queries and Data Access

The argument in full: Why Your Laravel App Is Slow. The refactor: the course's Queries and Data Access chapter.

1. Saving the same row more than once per use case

One action should write each row once. If the controller saves twice, an observer saves again, and a listener saves a fourth time, three places reason about the same row and a second caller, like an import job, has to know all three exist. Compute every field first and write once. Lesson: Laravel Observers: Saving the Same Reservation Four Times.

2. Declaring $with on the model

Eager loading declared on the model runs on every query that returns model instances: get, first, find, findOrFail, all, paginate, chunk, and, when it sits on User, the auth guard's lookup of the logged-in user on every authenticated request. It does nothing for count, exists, sum, or pluck, which run on the plain query builder. The cost is invisible at the call sites that pay it. Load relations at the query that reads them. Lesson: Laravel Eager Loading From the Model.

3. Running queries inside accessors

An accessor that queries turns $reservation->outstanding_balance into one query per row in a list, and strict mode does not catch it because it is not a lazy relation load. Accessors transform data already in memory; aggregates come from withSum and withCount at the query site. Lesson: Laravel Accessors That Run Queries.

4. Building reports with Eloquent

Eloquent is for the rows a use case reads and writes. A report that joins three tables and aggregates a month by room type belongs in the query builder or SQL, in a class that takes the connection and returns typed rows. Lesson: Laravel Query Builder for Reports, Not Eloquent Loops.

5. SELECT * on every list

A dropdown does not need every column. Once the table grows a JSON column and a text column, every list pays for them in bandwidth and hydration. Select the columns the screen reads. Lesson: Laravel Select and Pluck Instead of Every Column.

6. Loading the table and filtering in PHP

Guest::all()->filter(...) loads every row to keep a dozen. The database has the index and the planner; where and whereHas keep the filter where it can use them. Lesson: Laravel whereHas Instead of a Collection Filter.

Architecture and Code Organization

The argument in full: Why Your Laravel Codebase Is Unmaintainable. The refactor: the course's Architecture and Code Organization chapter.

7. Injecting controllers into other controllers

A controller is a class built to answer HTTP requests. When two of them need the same logic, the logic moves into a use case class that both call, and that a job or a command can call too. Lesson: Laravel Controllers Calling Other Controllers.

8. Reading Auth::user() inside services or handlers

The class now needs an HTTP request to run. It cannot run in a queue, a console command, or a test without faking the guard. Resolve the user at the edge and pass the id in. Lesson: Laravel Auth::user() Inside the Use Case.

9. app(SomeService::class) instead of constructor injection

Service location hides what a class needs, so the signature lies and tests have to boot the container to replace anything. Constructor injection makes the dependencies visible and swappable. Lesson: Laravel Dependency Injection vs Facades and app().

10. Business rules in traits

A trait shares code, not a concept. A rule inside one cannot be replaced, cannot be tested apart from the model, and reaches into $this for dependencies nobody declared. Give the rule a class. Lesson: Laravel Traits for Business Rules.

11. Files that never get split

The fat controller and the fat model happen because nothing in the framework stops them. Split by use case: one action per controller. Lesson: Laravel Resource Controllers That Never Get Split.

12. Sticking with the default folder structure

app/Http/Controllers, app/Models, app/Services groups code by what it is. Once the app has dozens of features, nothing related to reservations sits near anything else related to reservations. Group by module. Lesson: Laravel Folder Structure Is Not an Architecture.

13. Treating MVC as the architecture

MVC separates a UI from its data. It says nothing about where a use case, a command, or a domain event lives, which is why the default folders have no home for them. Lesson: Laravel Command Bus for a Use Case Without a Shape.

Request Handling and API Design

The argument in full: Stop Writing Laravel APIs Like This. The refactor: the course's Request Handling and API Design chapter.

14. Mass-assigning the request into the model

Reservation::create($request->validated()) writes whatever the request class validates today. Add a rule for an admin screen and the public endpoint accepts the field tomorrow. Name every field the handler writes. Lesson: Laravel Mass Assignment Straight From the Request.

15. Trusting raw request values

Passing validation is not the same as being safe to hand to orderBy. A client can name any column, including ones the resource hides, and read them through the row order. Allowlist with an enum and cast with the typed request helpers. Lesson: Laravel Validation Is Not Enough.

16. One endpoint doing several things

A PATCH that changes dates, cancels, and checks in depending on which keys arrive has a union of every rule and one permission check loose enough for all of them. Give each intent its own endpoint, request, and command. Lesson: Laravel API Design: One Endpoint Doing Four Things.

17. One Form Request for create and update

Create requires the room; changing dates forbids it. A shared class makes both dates sometimes, so a date change that sends only check_out passes and the stay silently starts today. Lesson: Laravel Form Request Shared by Create and Update.

Primitives and Value Objects

The argument in full: Your Laravel Code Needs More Objects. The refactor: the course's Primitives and Value Objects chapter.

18. Arrays for everything

An associative array passed between methods has no type, no autocomplete, and no guarantee that the key one method renamed still exists in the others. A DTO lets PHPStan flag a stale property name before the code runs. Lesson: Laravel DTOs Instead of Arrays for Everything.

19. Passing Eloquent models everywhere

A model in a queued mailable is reloaded from the database when the job runs, so the mail renders current state, not the state at dispatch. A model in a pricing class ties pricing to the table. Events and collaborators take ids, scalars, and DTOs. Lesson: Laravel Queued Mailables That Carry Eloquent Models.

20. Primitives where value objects belong

string $checkIn, int $cents, int $adults each carry a rule that lives in every place they are used. DateRange, Money, and GuestCount validate once, in the constructor, and carry the behaviour with the value. Lesson: Laravel Value Objects Instead of Primitives.