laravelmastery
SnippetsArticlesSeriesNews

Laravel that
holds up. Production-ready Laravel tutorials and snippets

Snippets you can paste today, and short courses that take you from “it works” to “it’s brilliant”.

Browse the seriesRead the snippets

Everything is free. No account, no card, no catch.

Snippets

Paste-ready Laravel, with the explanation and the video on each page.

All snippets

Refuse attributes a model will throw away

Catch a typo in a fillable list during development, before the column quietly stays null.

PHP
use Illuminate\Database\Eloquent\Model;

Model::preventSilentlyDiscardingAttributes(! app()->isProduction());
Guard railEloquent
Read the snippet

Name the interesting states

public function voided(): static { return $this->state(fn () => [ 'status' => 'void', 'voided_at' => now(), ]); }

A factory state keeps a void invoice readable in the test, instead of a pile of overrides.

Read the snippet

Stop the same job running twice

use Illuminate\Queue\Middleware\WithoutOverlapping; public function middleware(): array { return [new WithoutOverlapping($this->invoiceId)]; }

WithoutOverlapping holds a lock for one model so a double dispatch waits its turn.

Read the snippet

Catch N+1 queries before your users do

// app/Providers/AppServiceProvider.php use Illuminate\Database\Eloquent\Model; public function boot(): void { Model::preventLazyLoading(! app()->isProduction()); }

Turn lazy loading into an exception outside production, so missing eager loads fail loudly in development and tests.

Read the snippet

Series

Short, focused courses, all free. Each one tackles a single topic properly, in lessons you can finish on a lunch break.

See every series
E

Eloquent, properly

Relationships, scopes, casts and query performance, built up from a real app rather than toy examples.

13 lessons · 2 hr 10 min · Intermediate

Open
Q

Queues in production

Retries, backoff, batching and idempotent jobs, so background work keeps running when things go wrong.

10 lessons · 1 hr 35 min · Advanced

Open
T

Test-driven Laravel

Feature tests, fakes and factories that give you the confidence to refactor without fear.

15 lessons · 2 hr 40 min · All levels

Open

Articles

All articles

Dispatch after commit: jobs that never see half-saved data

Queued work should wait until the invoice transaction commits, and disappear if it rolls back.

26 Oct · 9 min read

Read

Jobs that don’t fall over: designing idempotent queue workers

What happens when a job runs twice, and how to make sure it doesn’t matter.

14 Oct · 9 min read

Read

Form requests are doing more than you think

Authorisation, preparation and after-validation hooks that tidy up fat controllers.

7 Oct · 9 min read

Read

A practical guide to caching Eloquent results

When to cache, what key to use, and how to invalidate without tears.

30 Sep · 8 min read

Read

Policies vs gates: choosing the right authorisation tool

A short decision guide with examples from a multi-tenant app.

23 Sep · 10 min read

Read

Latest news

  1. Laravel NewsDeferred Schema Loading in Filament v5.826 October 2026
  2. Laravel NewsSloppy: Static Analysis for AI-Written PHP26 October 2026
  3. Laravel NewsMastering Laravel Testing: A Video Course on Laravel Tests26 October 2026
  4. Laravel NewsNativePHP Mobile Security Advisories: Update to 4.6.126 October 2026
  5. Laravel NewsVolker Dusch on the PHP RCE Vulnerabilities and Disclosure23 October 2026

All news

Get the Friday email

One snippet and the week’s Laravel news, in your inbox every Friday morning. Unsubscribe whenever you like.

laravelmastery

Practical Laravel learning for working developers, made in the UK.

Learn

  • Snippets
  • Articles
  • Series

Stay current

  • News
  • Friday email
  • RSS feed

Company

  • About
  • Privacy
  • Terms
© 2026 Laravel Mastery. Independent and not affiliated with Laravel Holdings Inc.Designed and built by Half Shell Studios

We remember the videos you watch, where you left off, and which series lessons you mark as read, against this connection’s address. Nothing is stored until you agree.