Tag: tips
-
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 querying the database and […]