What Is Laravel Middleware?
Middleware runs between a request arriving and a controller handling it — the mechanism behind auth checks, CORS headers, and rate limiting, all inspecting or modifying the request/response without the controller knowing.
GUIDES
Middleware runs between a request arriving and a controller handling it — the mechanism behind auth checks, CORS headers, and rate limiting, all inspecting or modifying the request/response without the controller knowing.
This error means Laravel's service container can't resolve the class the route is pointing at — almost always a namespace mismatch, a typo, or a stale autoload cache, not an actually missing file.
with() by default pulls every column from a related table — narrowing that down matters for a wide table, but forgetting the foreign key column produces a relationship that silently comes back null.
A cast is what turns a raw JSON text column into a working PHP array automatically on every read and write — without one, Eloquent hands back and expects a plain JSON string instead.
The backend piece — a debounced, rate-limited JSON search endpoint — stays the same regardless of which frontend autocomplete widget consumes it, and that endpoint is the part actually worth getting right.
Beyond auth (which uses sessions internally), the Session facade is the standard place for anything that needs to persist briefly across requests for one visitor — flash messages, a multi-step form's in-progress data, a shopping cart.
The four pieces of a real CRUD resource — listing with search and pagination, image-handled create/update, and safe delete — assembled into one practical, version-agnostic walkthrough.
Passing the same data (a site name, a list of categories for a navbar) into every single controller method that returns a view doesn't scale — View::share() and view composers exist to avoid exactly that repetition.
Artisan's make: commands scaffold boilerplate consistently — the useful part is the flag shortcuts that generate a model together with its migration, factory, and controller in one command.
Beyond a basic Route::get(), the features that actually shape a real app's routes are parameters, route model binding, named routes, and grouping shared middleware or prefixes together.
php artisan make:component, passing data as props, and the difference between a class-backed component and an anonymous view-only one.
A raw query is only as safe as its parameter binding — concatenating a variable directly into a raw string reopens the exact SQL injection risk Eloquent otherwise protects against automatically.