Laravel

Setting up Laravel Sanctum (Airlock) for SPA authentication with Vue.js

March 29th, 2020 — Laravel Sanctum (previously known as Laravel Airlock) is an official Laravel package to deal with both API token and SPA (Single Page Application) authentication.

Laravel Sanctum (Airlock) with Postman

April 14th, 2020 — I'm really excited to be using Laravel Sanctum, but once I fired up Postman to start testing my endpoint responses, I realised this would take a little more work than just attaching a token (unless you're using token based authentication with Sanctum).

Accessing authenticated user details with JavaScript in Laravel

June 8th, 2020 — If you're using Vue/Alpine or any other JavaScript in your Laravel projects, chances are at some point you'll need to grab authenticated user information.

Laravel Websockets on Forge (The Complete Guide)

July 16th, 2020 — The popular Laravel Websockets package makes it really easy to get realtime functionality working on your Laravel projects, but what happens when it's time to deploy? If you're using Forge, this article guides you through every step of the way.

Laravel Authentication: UI vs Jetstream vs Fortify vs Breeze

December 27th, 2020 — In this article, I want to outline as simply as possible the differences between four first-party Laravel packages – UI, Jetstream, Fortify and Breeze. All, to some extent, help you scaffold your apps (or parts of them) so you can get on with the good stuff.

Replicating Database Records in Laravel

July 11th, 2021 — I recently found myself needing to replicate a database record in Laravel. Turns out, there's a really easy way to achieve this.

6 ways to avoid IF statements in Laravel

July 14th, 2021 — If statements are evil and should be avoided at all costs. Just kidding – but reducing the number of them can increase the readability/size of your code.

Recursively convert an array and its children to a Collection in Laravel

November 13th, 2021 — If you're dealing with plain array data, it often makes sense to convert it to a Laravel Collection so you can make use of the myriad helpers on the Collection class.

Recursive Nested Data in Laravel, The Right Way

November 21st, 2021 — 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.

Enable HTTPS in Laravel Valet

January 28th, 2022 — 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.

Laravel Mix HMR with HTTPS

January 28th, 2022 — 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.

Clear orderBy in Laravel's Eloquent Builder

January 29th, 2022 — 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.

Setting up Laravel Friendship Relations

April 15th, 2022 — 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.

How to check a Laravel project's version

January 4th, 2023 — Sure, it's pretty simple. But you're going to need check at some point.