Tag: laravel
-
5 Tips to Simplify Laravel Code
Reading Time: 3 minutes 1. Simplify if/else statements When writing methods or functions that use if/else statements to check for a condition, we can clean up the function or method by using the shorthand version of a simple if/else like so: 2. Use Laravel’s exists() instead of count() to verify a model instance exists. When…
-
Single Responsibility Principle and Laravel
Reading Time: 9 minutes Developers across the industry are familiar with the Single Responsibility Principle, the idea that our classes, or our functions should have one and only one job to do. This idea helps us better document, understand, write, and update our own code as well as the code of a team member or…