Code Explainers

Laravel code explainers

php
namespace App\Providers;
 
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;

Building a @money Blade directive in Laravel

blade-directive service-provider localization
Intermediate 5 steps
php
<?php
 
namespace App\Providers;
 

Defining authorization gates in Laravel

authorization gates service-provider
Intermediate 6 steps
php
<?php
 
namespace App\Http\Requests\DataObjects;
 

Typed request DTOs in Laravel

data-transfer-object validation immutability
Intermediate 6 steps
php
<?php
 
namespace App\Jobs;
 

Rendering invoice PDFs in a Laravel queue job

queued jobs pdf generation file storage
Intermediate 9 steps
php
<?php
 
namespace App\Services;
 

Building a valid iCalendar feed in PHP in Laravel

ical serialization formatting
Intermediate 8 steps
php
<?php
 
namespace App\View\Components;
 

Building a breadcrumb component in Laravel

blade components url parsing string manipulation
Intermediate 8 steps
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