7
๐ฅ Create methods for complex conditionals
Encapsulating complex conditionals offering a "callable" API is sexy AF. ๐
๐ฅ This week's code tips for Laravel developers
A weekly thread ๐งต
7
Encapsulating complex conditionals offering a "callable" API is sexy AF. ๐
6
๐ Laravel Tip: Save time when typing migration names by using quotes around the name!
5
๐ถ๏ธ #Laravel tip: Sometimes you may need to send a notification to someone who is not stored as a "user" of your application.
Welcome to On-Demand Notifications in Laravel ๐ฅ
#PHP #Developers
4
Use the @laravelphp's "tap()" function to do something with an object, and then return the object itself. ๐ง
3
Laravel tip: Use the "{action}_at" naming convention for your DATETIME and TIMESTAMP fields.
This helps you to instantly recognise in your code when you're using a datetime field ๐
#laravel #php
2
โก๏ธ Database Tip
Everyone knows the LIMIT clause. But what do you do if you want to have e.g. the employees with the TOP 3 salaries and not exclude the 4th or 5th one earning the same as the 3rd? The WITH TIES clause can return more results if the value is the same. Great!
1
Did you know that you can create a "Subscriber" class in Laravel to handle multiple events with different methods in one Listener class?
This is very useful if you want to group certain actions with the same dependencies.
Documentation: https://laravel.com/docs/9.x/events#event-subscribers
We're writing a book, you can get it for free here. We're writing a book! Join the early access to get it for free.