Laravel Pro Tips
#DB
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 #models #DB
π 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 π₯
#collections
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 π #laravel
Peter Fox
#eloquent #relationships
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 β‘
#strings
π₯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 π
LaraShout
#authentication #middleware
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 #Laravel #laravelphp
Marouan Afkir
#admin #middleware
#Laravel Tip: 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.
andywong31
#http #guzzle
Need to know the transfer time of a HTTP post in #Laravel or Guzzle? Use this method to get that info!
Braunson Yager
#artisan
#Laravel artisan:tinker Tip π₯ searching for an old artisan:tinker line? Just type `history` and grab from the list π
Phonosheet