These posts are about a subject that involves PHP.
February 11, 2021
When working with Laravel, you will probably use the query builder in order to create and run database queries. Sometimes you want to see the raw SQL output of a query, for example when you are...Read
November 25, 2020
Since Laravel 8.16, it is possible to split a collection into chunks in two different ways. The first one, that already existed, is the split method: This method breaks a collection into a...Read
November 16, 2020
When creating a catch-all route in Laravel, you might encounter conflicts with others routes in your application. In this post I would like to describe how you can resolve some of these conflicts....Read
October 1, 2020
When you want to show a list of all registered routes in your application, you can use the
php artisan route:list command.
The output of this command can be a bit confusing when you are...
September 1, 2020
Sometimes you want to call an Artisan command from your code. Some commands show data. How do you read the data that an Artisan command may show in the console? For example, you could have a...Read
August 18, 2020
When you need to update a resource in Laravel, you might decide to use the
update or the
Let's take a look at the source code of the
July 8, 2020
Laravel 7 introduced Custom Eloquent Casts. Next to primitive types, such as json, it is also possible to cast values that form a compound to objects. This is an effective way to introduce value...Read
June 17, 2020
With configuration caching you can bundle all configuration files, to be loaded faster by Laravel.
When you run
php artisan config:cache, a new file will be created in...
May 16, 2020
Since 7.x, Laravel provides a very compact syntax for creating foreign key constraints with the
In this post we will give a short demonstration of this syntax, and we...
April 24, 2020
Recently I stumbled upon a nested query in a Laravel project. It was written like this: You might have seen a comparable nested query in the code you had to work on, and you probably agree that...Read
April 19, 2020
Laravel 7 came with a new feature, stub customization. Stub customization gives the ability to modify the stub files that are used when creating classes such as controllers and tests with the...Read
March 29, 2020
Since the release of Laravel 7.x, you can run you tests by executing
as an alternative to running your tests with the
This command will run all your tests, until the...
March 11, 2020
Laravel 7 has an excellent new feature, called fluent string operations. It provides an "object-oriented interface for working with string values", e.g. becomes In this post I would like to...Read
February 27, 2020
PHP_CodeSniffer is a useful tool to check your code against a set of standards and rules. It can help in securing a certain coding standard and style within a development team, by running PHPCS as a...Read
February 21, 2020
A guide on how to install Elasticsearch on MacOS in order to use it as a driver for Laravel ScoutRead
February 1, 2020
The Laravel service container is called "a powerful tool for managing class dependencies and performing dependency injection". In this post, we will look at a possible use case of the service...Read
January 23, 2020
In most cases, when writing policies in Laravel, you only pass one argument to a policy method, since the authenticated user is already available through dependency injection and no other resources...Read
December 20, 2019
Just recently I discovered you can apply
where statements to the
exists validation rules in Laravel, without using a closure.
This means you can...
December 15, 2019
One of the cool things of Laravel's validation rules, is that you can apply certain rules to different data types. When checking the minimum and maximum size of an array, you can use the...Read