Calling env() in a controller works in development and returns null in production. Here is why config caching breaks it and the one rule that avoids the trap.
Articles
Storing money as a float invites rounding bugs. Build a custom Eloquent cast that keeps cents as integers in the database but exposes a clean value object.
Wrapping related writes in a transaction is easy to get subtly wrong. Laravel's DB::transaction() closure handles commit, rollback, and deadlock retries for you.
Facades look like static calls but are not. Understanding how Cache::get() reaches a real object in the container explains why facades stay testable.
Forge now provisions Valkey caches and object storage buckets directly from the dashboard, bringing two more pieces of app infrastructure under one roof.
Laravel's Stringable class turns nested PHP string functions into a readable left-to-right chain. Here are the methods worth committing to memory.
Take a Laravel app from hardcoded English strings to a properly localized interface with translation files, pluralization, and a middleware that sets the locale.
Stop wrapping query builder calls in if statements. The when() and unless() methods let you apply constraints conditionally while keeping the chain fluent.
Laravel's June 2026 updates added Bus::bulk(), which queues large batches of jobs with a single database insert per connection instead of one write per job.
Building a CSV export that holds an entire table in memory works until the table grows. Here is how to stream a download row by row so memory stays flat.
Eloquent will happily hide an N+1 query until it hits production. Strict model mode turns those silent mistakes into loud exceptions during development.
A handful of Artisan optimization commands shave real milliseconds off every request in production. Here is what each one does and when to run it.