Posts About Laravel
Laravel is a powerful PHP framework that simplifies web development with its elegant syntax and comprehensive toolkit. It streamlines tasks like routing, authentication, and caching, making it ideal for both simple and complex applications.
Modern Laravel Queue Features Worth Knowing
The Laravel queue system grew a set of features that, taken together, make it genuinely production grade. Here is a tour of the ones worth hav...
Fixing the "Specified key was too long" Migration Error in Laravel
If you have hit this error while running migrations, here is the quick fix and the reason behind it. Why it happens Laravel uses the utf8mb4 c...
One Slow API Call Can Freeze Your Queue Worker
A worker has been on the same job for four minutes. The CPU is idle, the database is fine, and nothing is in the log. It is not stuck in a loo...
Creating and Using Query Scopes in Laravel
A query scope is a reusable piece of a query that you keep on the model. Instead of repeating the same where everywhere, you give it a name an...
Creating Foreign Key References in a Laravel Migration
A foreign key is how the database itself enforces that a row in one table points at a real row in another. Laravel makes adding one short, and...
Avoiding Lock Timeouts When Dispatching Large Job Batches
Batches are great until you dispatch a really big one. Push thousands of jobs into a single batch and you can deadlock your own queue, with wo...
Handling API Rate Limits in Queued Jobs
If your jobs call a third party API, sooner or later you will hit its rate limit and start getting 429 Too Many Requests. Hammering the API ha...
Stop Hammering a Dead API From Your Queue
Your CRM integration goes down at nine in the morning. There are two thousand contact-sync jobs on the queue, and every one of them is now goi...
Using Aggregate Functions with Eloquent in Laravel
Sometimes you do not want the records themselves, you want a number about them. How many active products, the highest price, the average ratin...
Laravel Queue Configuration Keys Explained
A few queue settings trip up nearly everyone, mostly because two of them look like they do the same thing and actually do not. Here is each on...
File Uploads and Storage in Laravel
Laravel's Storage API lets you handle files without caring where they actually live. The same code works whether the files are on the local di...
How to Retry Failed Jobs in Laravel
A third-party endpoint was down for twenty minutes overnight. It is back, and now there are four hundred rows sitting in failed_jobs. The work...
Getting Notified When a Laravel Job Fails
A job that creates shipping labels retries three times against a carrier API that is having a bad morning, then gives up. The row lands in fai...
Pointing Your Domain at the Laravel public Folder
A Laravel project has one folder that is meant to face the web: public. Everything else, your code, your .env, your config, sits above it and...
Working with Large Result Sets in Laravel
The moment you call get or all on a big table, Laravel loads every matching row into memory and builds a model for each one. On a few hundred...
Job Has Been Attempted Too Many Times or Run Too Long
You open your logs or failed_jobs table and find a job marked failed with MaxAttemptsExceededException and the message "Job has been atte...
Making Queued Jobs Safe to Run Twice
A customer gets charged twice. Or the same shipping confirmation lands in their inbox three times. You read the job, and the logic is fine. It...
How Notification Channels Work in Laravel
When a notification is sent, each channel listed in via() has to be turned into a real object that knows how to deliver the message, and the m...
Extending Laravel with Macros
Many of Laravel's core classes are "macroable", which means you can bolt your own methods onto them at runtime without touching the...
Handing a File Upload to a Queued Job
A support ticket lets people attach a screenshot, and you want the resizing done in the background. The obvious thing fails immediately: There...