Articles

Showing 10 posts
February 21st, 2024

Securing Your Laravel Herd Sites with TLS

Laravel Herd comes with full TLS (an upgraded version of SSL) support out the box, but it's not as easy as just switching it on if you're using a build tool like Vite.

Author
Alex Garrett-Smith
Server
Laravel
December 30th, 2023

Cleaner Loops With Laravel's Forelse Directive

If you're wrapping foreach loops around if statements in Blade, here's a much cleaner way to achieve the same thing with a single directive.

Author
Alex Garrett-Smith
Laravel
January 23rd, 2023

Using Enums as model casts in Laravel

Using accessors to return Enums from Laravel model attributes? There's an easier way.

Author
Alex Garrett-Smith
Laravel
January 11th, 2023

Change Carbon's now() value for testing

If you're working with Carbon dates, chances are your tests are going to fail at some point unless you're sure of the value returned from Carbon's now() function.

Author
Alex Garrett-Smith
Laravel
PHP
January 4th, 2023

How to check a Laravel project's version

Sure, it's pretty simple. But you're going to need check at some point.

Author
Alex Garrett-Smith
Laravel
April 15th, 2022

Setting up Laravel Friendship Relations

Friendships between users in an app is a pretty easy concept to grasp (you add me and we're friends), but to implement it properly isn't as straightforward.

Author
Alex Garrett-Smith
Laravel
January 29th, 2022

Clear orderBy in Laravel's Eloquent Builder

If you've tried to use `orderBy` on a previously ordered query in Laravel, you'll probably find it doesn't work. There's a great reason for that, which we'll explain at the end of the post.

Author
Alex Garrett-Smith
Laravel
Eloquent
January 28th, 2022

Enable HTTPS in Laravel Valet

By default, Laravel Valet doesn't use HTTPS. That's great, but if anything you're developing with locally requires HTTPS to be enabled, you're going to need it.

Author
Alex Garrett-Smith
Laravel
January 28th, 2022

Laravel Mix HMR with HTTPS

I use Laravel Valet for day-to-day development, and I recently got stuck getting Laravel Mix HMR (Hot Module Replacement) to work while I had HTTPS enabled through the `valet secure` command.

Author
Alex Garrett-Smith
Laravel
November 21st, 2021

Recursive Nested Data in Laravel, The Right Way

Nested data is a pain point for a lot of developers. Relationships, eager loading and recursively iterating and displaying hierarchical data is enough to cause a headache.

Author
Alex Garrett-Smith
Laravel

Tags