Laravel

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...

3 mins read

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...

2 mins read

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...

4 mins read

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...

2 mins read

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...

2 mins read

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...

3 mins read

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...

3 mins read

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...

4 mins read

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...

2 mins read

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...

4 mins read

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...

2 mins read

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...

4 mins read

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...

3 mins read

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...

2 mins read

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...

2 mins read

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...

3 mins read

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...

4 mins read

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...

3 mins read

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...

2 mins read

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...

3 mins read