Laravel Pro Tips
While adding a New Column to existing table using Migration, the column is always added at the last.✅You can use the after() to place the New Column after a specific column.✅You can also use the first() to place the New Column at the start of the table. #Laravel #PHP
Aftab Khan 🚀
🔥 Laravel Tip: Factory states
You can create factory states in your model factories to hide the details about the model attributes and make your tests more readable.
You've probably joined an array into a comma separated string before. But what about when you want the last one to say "and"? With Laravel collections it's a breeze 🍃
If you have a collection, and you want to get items from the end of it, you may pass a negative integer to `take()` method to take the specified number of items from the end:
Here is an example:
👉 A #laravel HTTP Client #CheatSheet
⚡️Some of the methods you can use before you send your request 🔥
Aaron Lumsden 🎉 | Indie Hacker Dev
👉 A #laravel Storage #cheatsheet 🔥 #php
How many of these methods do you know? 🚀
#Laravel Tip 🔥 When using a custom keyed implicit binding as a nested route parameter, Laravel will automatically scope the query to retrieve the nested model by its parent using conventions to guess the relationship name on the parent.
#Laravel livewire Tip:
If you want to use `authorize` method inside livewire component, all what you need to do, is to use `AuthorizesRequests` trait.
Here is how to do it:
🔥 Laravel Tip: Did you know that mass updates return the number of affected rows?
This is useful when you want to display the number of records that were updated in the database.