Laravel

Posts about Laravel

May 8, 2021

Auto generating argument typehints for PhpStorm in Laravel projects

In a Laravel project you can generate PHPDocs and PhpStorm Meta using the barryvdh/laravel-ide-helper package. We can add additional typehints for custom functions by writing a command to generate a...

Read

January 30, 2021

Single component events in Laravel Livewire

When rendering multiple instances of the same Livewire component on a page you may want to emit an event to a specific child component, not all components of the same type. Take for example this...

Read

January 23, 2021

Eager loading complex functions with Laravel custom collections

In Laravel, we can eager load relationships to prevent n+1 queries being performed when fetching multiple records from the database. An example taken from the Laravel docs. This works great for a...

Read

November 9, 2020

Testing Laravel routes have middleware

In some applications you might require every route to be protected by authentication. We can use tests to make sure that all of your routes are using the correct middleware and are not accessible...

Read

October 8, 2020

Protecting LiveWire components when using multiple auth drivers

Laravel Livewire provides a dead easy way to add dynamic components to your site without the need to write any JavaScript. Although Livewire does support authentication out of the box, if you have...

Read