Laravel global scope ambiguous issue
Published on
I came across a small edge-case when using Laravel's Global Scopes after following the example in the documentation. I created an "Active" scope, which can be applied to multiple m…
Published on
I came across a small edge-case when using Laravel's Global Scopes after following the example in the documentation. I created an "Active" scope, which can be applied to multiple m…
Published on
Laravel comes with a few tools which help you manage authorisation and restrict how different users interact with your application. The Laravel documentation for Authorisation covers how you…
Published on
I have been using Laravel's Global Scopes in a recent project. Global scopes are a great way to ensure you're only returning the data you need, especially if you're using soft deleting or ot…
Published on
It was the end of the month and another date bug raised its head. In my Laravel application, I make use of the dependency Carbon, which adds syntactic sugar to help manage notoriously comple…
Published on
In a recent blog post, I wanted to use the Spotify embed code, so I could easily showcase the music about the bands I was talking about. However, I stumbled across a massive problem. My blog…
Published on
Checkboxes are an HTML element that allows you to define a simple on/off piece of information. However, developers often stumble across an issue where if the checkbox is not checked, then no…
Published on
Laravel provides a flexible way of using different "disks" or filesystems to store files. This means you can store files locally in a path relative to your code or using a remote s…
Published on
I was running a test suite and noticed that a couple of the tests were stalling. I didn't know which were running slow, so I investigated how I can log which tasks were taking too long to ru…
Published on
I wanted to add an item to a Laravel Collection, based on a truthy condition. In the script, I quickly jumped for the basic if syntax, but then wondered if there was a nicer way. if ($condit…
Published on
I have previously been writing custom Laravel validation rules with explicit passes() and message() methods. However, since Laravel 9, the preferred method is now a little different. The doc…