- Messages
- 27
- Likes
- 6
- Trophy Points
- 5
- Followers
- 2
- Joined
- Mar 17, 2022
Starting today, I will be posting one to two Laravel refactoring tips a week. If this is what you are interested in, you can follow/watch this thread.
I will also make it sticky so that it is fixed at the top of the list under the Laravel (PHP Framework) forum.
Also, In the end, I used the null safe operator that became available in PHP 8. It can also be used in the first condition if you prefer to stick with the if statement.
I will also make it sticky so that it is fixed at the top of the list under the Laravel (PHP Framework) forum.
Laravel Tip #1
Here is an example of how we can use theabort_if
method to make the code cleaner.Also, In the end, I used the null safe operator that became available in PHP 8. It can also be used in the first condition if you prefer to stick with the if statement.