Laravel Pro Tips
#Laravel Tip 🔥
You can use 'inRandomOrder' method to sort the results of models randomly.
🔥 Laravel Tip: You can specify what to do if a scheduled task fails or succeeds.
Laravel Tip💡You can hide your auto-incremented database IDs from your users by hashing the ID using a library like HashId🕵️
Carbon provides next() and previous() functions that return upcoming and previous occurrences of a particular weekday or time.
Laravel Tip 💡 Add a 'before()' method to your policy to validate a global condition before checking the actual policy permission. Useful when working with multiple guards and/or roles, for example.
#Laravel #Eloquent Tip:
Laravel v9.7 shapes with `whereJsonContainsKey()` method to allow you to check for array integer keys. See the below example.
#Laravel #Database #PHP
🔥 Laravel Tip: In your migrations, you can add multiple columns after another column using the after method.
💡 Quick #Laravel validation tip.
If you want to make sure start and end dates in your forms are entered in the right order, the before_or_equal and after_or_equal rules got you covered.
But what if you want either of the dates to be nullable?
Rule::when() to the rescue! 🚀
Lupinity Labs | Freelance Software Dev
The more I discover more about Laravel, the more I love it... You can check if a password has been uncompromised ?? :o
Noah Di Gesù 🤌