Code Explainers

Laravel code explainers

php
<?php
 
namespace App\Console\Commands;
 

Releasing stale document locks in Laravel

artisan-command transactions row-locking
Intermediate 6 steps
php
<?php
 
namespace App\Providers;
 

Subdomain multi-tenancy routing in Laravel

multi-tenancy service-container route-binding
Advanced 7 steps
php
<?php
 
namespace App\Broadcasting;
 

Authorizing presence channels in Laravel

broadcasting authorization presence-channels
Intermediate 3 steps
php
<?php
 
namespace App\Http\Middleware;
 

Resolving the current team in Laravel middleware

middleware multi-tenancy cookies
Intermediate 8 steps
php
<?php
 
namespace App\Http\Controllers;
 

Broadcasting typing indicators in Laravel

websockets authorization presence-channels
Intermediate 9 steps
php
<?php
 
namespace App\Services\Reports;
 

Streaming a monthly revenue CSV in Laravel

csv-export lazy-collections eloquent-query
Intermediate 8 steps
php
<?php
 
namespace App\Services;
 

Computing rolling averages in Laravel

rolling-average date-ranges collections
Intermediate 8 steps
php
<?php
 
namespace App\Http\Support;
 

Adding RFC 5988 Link headers in Laravel

pagination http-headers rest-api
Intermediate 7 steps
php
<?php
 
namespace App\Jobs;
 

A retrying queue job in Laravel

queues background-jobs retries
Intermediate 7 steps
php
<?php
 
namespace App\Providers;
 

Defining feature flags with Laravel Pennant

feature-flags service-provider config-driven
Intermediate 6 steps
php
<?php
 
namespace App\Http\Controllers;
 

Email confirmation with signed URLs in Laravel

signed-urls email-verification middleware
Intermediate 6 steps
php
<?php
 
namespace App\Models\Concerns;
 

How an Auditable trait logs Eloquent changes in Laravel

traits model-events polymorphic-relations
Intermediate 8 steps
php
<?php
 
namespace App\Http\Controllers;
 

Server-Sent Events in Laravel

server-sent-events streaming long-polling
Advanced 9 steps
php
<?php
 
namespace App\Actions\Imports;
 

Streaming CSV imports with Laravel batches

lazy-collections job-batching streaming
Advanced 9 steps
php
namespace App\Providers;
 
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Log;

Catching N+1 queries with Eloquent strict mode in Laravel

n+1 queries strict mode eager loading
Intermediate 7 steps
php
<?php
 
namespace App\Http\Controllers\Api;
 

Building a cursor-paginated feed in Laravel

cursor-pagination eager-loading validation
Intermediate 8 steps
php
<?php
 
namespace App\Services;
 

Caching per-tenant settings in Laravel

caching multi-tenancy dependency-injection
Intermediate 7 steps
php
<?php
 
namespace App\Http\Middleware;
 

Idempotency keys in Laravel middleware

idempotency middleware caching
Advanced 8 steps