Articles

Showing 10 posts
September 17th, 2024

Dive into Laravel's new defer() helper

Laravel recently introduced a new defer helper function, allowing you to defer the execution of a closure until a response is sent to the user — helping make these responses feel much faster. Let's dive into how it works.

Author
Alex Garrett-Smith
Laravel
September 16th, 2024

How to (Efficiently) Count Records with Laravel

There are several ways to get the row count from your database with Eloquent in Laravel. Let's cover the basics and then look at a much better solution when counting on related models — using aggregates at the database level.

Author
Alex Garrett-Smith
Eloquent
Laravel
September 12th, 2024

How to Alias Middleware in Laravel 11

Since Laravel 11 removes the Kernel class, how do we alias middleware? Let's take a look.

Author
Alex Garrett-Smith
Laravel
September 11th, 2024

Using Cloudflare Turnstile with Livewire

Setting up, configuring and validating a Cloudflare Turnstile challenge with Livewire is simple, thanks to the Laravel-cloudflare-turnstile package. Let's look at how to set it up!

Author
Alex Garrett-Smith
Livewire
Laravel
July 19th, 2024

Logging Users Out of Other Browser Sessions with Laravel

Laravel provides a method for logging users out of all other browser sessions by re-hashing passwords. Let's look at how to use it to invalidate all other browser sessions for your users.

Author
Alex Garrett-Smith
Laravel
July 18th, 2024

Match Wildcard Routes in Laravel

Here's a quick tip on matching wildcard routes in Laravel. Once you're done, you can access the wildcard value and do anything you need to do with it.

Author
Alex Garrett-Smith
Laravel
July 17th, 2024

Easily Add Breadcrumbs to your Laravel Websites

Adding breadcrumbs to your Laravel sites has quite a few benefits. Let's look at the easiest way to add breadcrumbs in Laravel, and a few tips on customising them.

Author
Alex Garrett-Smith
Laravel
July 15th, 2024

How to get the next and previous records in Laravel

Laravel doesn't have built-in support to fetch next and previous records, but adding a couple of helper methods to your model does the trick.

Author
Alex Garrett-Smith
Eloquent
Laravel
July 12th, 2024

How to fix toOthers when broadcasting with a Laravel API request

The toOthers method won't work correctly if you're triggering a broadcast via an API request to your Laravel application. Here's why and how to fix it.

Author
Alex Garrett-Smith
Laravel
July 11th, 2024

How to Use orderBy() (and more) for Sorting Eloquent Query Results

Ordering in Laravel is pretty straightforward, but you can use a few other techniques to make the most of Eloquent's ordering abilities. Let's cover everything you should know about ordering queries with Laravel!

Author
Alex Garrett-Smith
Eloquent
Laravel

Tags