Laravel Pro Tips
Laravel tip. If you want to get the list of the columns for a certain table, it's easy.
Povilas Korop | Laravel Courses Creator & Youtuber
🌟 Eloquent tip
If you need to insert or update a whole bunch of records in a loop, don't use `Model::updateOrCreate`.
Instead, use the `DB` facade's `upsert` method to use your database's built-in upsert functionality to do the whole thing in one query!
Kai Sassnowski 🥔
If you ever need to build a quick CSV export command for your Laravel application.
This is how I would recommend doing it. Open a resource to StdOut and then chunk your results and write them to the output using fputcsv(). It'll handle the CSV output perfectly 👌
Here's a pro tip 🔥 for all you Laravel developers: You can customize the default order of data retrieved from relationships!
#Laravel #PHP #PHPRC
Mohammad Haris ⚡
🔥Laravel squish() Method: The 𝘀𝗾𝘂𝗶𝘀𝗵 method removes all unnecessary white space from a string, including unnecessary white space between words. #Laravel
See how you can use it in your application 👇
How to implement multi-login redirections in @laravelphp, you can use middleware to check the user's role and redirect them to the appropriate page
If your user only has a role of admin or user, you can create a column of 'is_admin' (boolean type) in the users table and create a custom middleware to check if user is admin or not.
Need to know the transfer time of a HTTP post in #Laravel or Guzzle? Use this method to get that info!
#Laravel artisan:tinker Tip 🔥 searching for an old artisan:tinker line?
Just type `history` and grab from the list 🚀