LLoadout refactor shows you code refactorings from real life projects. These refactors are mostly suggested refactors in pull requests

Model naming conventions will save you time

If you use the naming conventions as stated in the documentation you will prevent a lot of boilerplate code

Refactoring a switch statement

In this refactor we refactor a switch statement to an array approach

Refactoring to null coalescing operators

In this refactoring we refactor isset to the null coalescing operator and expand it with the null coalescing assignment operator

Change the case of array keys

Sometimes you want to change the case of array keys, this can been done efficiently

Refactoring to collection filter

Collections are very powerful, this refactor shows the filter method

Refactoring to collections, groupby, map and sum

Collections are very powerful, here we show the power of groupby, map and sum in one line

Laravel blank and filled helper

The hand blank and filled helpers for Laravel are a nice way to determine variable state

Refactoring to the optional helper

The optional helper gives you a clean syntax, instead of using checks

Refactoring to arrow function

In this refactoring we change a function call to fn, for onliners this is a huge improvement

Refactoring to match

In this refactoring we change a switch statement to a match statement

Refactoring to null safe operator

In this refactoring we make use of the nullsafe operator, so we can get null back without blowing our code

Refactoring to property promotion

In this refactoring we show the power of propery promotion, this can save you many lines of code

Refactoring to constants

Using constants is much more self-explanatory than using numbers

Dry programming

Sometimes i find myself repeating code , most of the time when business logic changes and we start implementing if statements.

This repo is open sourced and works with some magic under the hood. The example on the left is automagically created from the code on the right.

This project is sponsored by

Delta Solutions

Want to learn more from LLoadout ?

LLoadout is your loadout for Laravel, helping you kickstart your development process. Besides this refactoring site we also make some cool packages and video tutorials !

Go to LLoadout on github