LaravelProTips's profile picture. The best and hottest tips for Laravel developers. Search or browse to level up your dev work.

Laravel Pro Tips

@LaravelProTips

The best and hottest tips for Laravel developers. Search or browse to level up your dev work.

Laravel Pro Tips รีโพสต์แล้ว

Thinking about rolling a new web server with @Vultr. Been looking at them for a while and think it's a good time to take the leap. Any #Laravel friends have a referral code they want to drop?


Laravel Pro Tips รีโพสต์แล้ว

Genuine question: How much of the #PHP Community uses MacOS for development? Please RT so that the whole community can vote! #Laravel #LaraconUS As a member of the PHP community my main OS is:


Laravel Pro Tips รีโพสต์แล้ว

Another day, another Laravel tip. If you need to catch exceptions and don't want to stop the execution of further code, please make sure you use report(). Make it easy for yourself to log the problems! #laravel #php #phpc

SlyFireFox's tweet image. Another day, another Laravel tip.

If you need to catch exceptions and don't want to stop the execution of further code, please make sure you use report(). Make it easy for yourself to log the problems!

#laravel #php #phpc

Laravel Pro Tips รีโพสต์แล้ว

So I heard y'all like types in your ORM. Laravel allows you to define casts at the model level to handle casting values to their native types. More interestingly, it also allows you to define them at query time, so you're not sacrificing the power of SQL 💅

aarondfrancis's tweet image. So I heard y'all like types in your ORM. 

Laravel allows you to define casts at the model level to handle casting values to their native types.

More interestingly, it also allows you to define them at query time, so you're not sacrificing the power of SQL 💅
aarondfrancis's tweet image. So I heard y'all like types in your ORM. 

Laravel allows you to define casts at the model level to handle casting values to their native types.

More interestingly, it also allows you to define them at query time, so you're not sacrificing the power of SQL 💅

Laravel Pro Tips รีโพสต์แล้ว

🌟 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!

warsh33p's tweet image. 🌟 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!

Laravel Pro Tips รีโพสต์แล้ว

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

SlyFireFox's tweet image. 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

Laravel Pro Tips รีโพสต์แล้ว

🔥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 👇

rukhsardev's tweet image. 🔥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 👇

Laravel Pro Tips รีโพสต์แล้ว

Need to know the transfer time of a HTTP post in #Laravel or Guzzle? Use this method to get that info!

braunshizzle's tweet image. Need to know the transfer time of a HTTP post in #Laravel or Guzzle? Use this method to get that info!

Laravel Pro Tips รีโพสต์แล้ว

#Laravel Tip: Queries that need to examine string columns will always be slower than integer columns (even when indexed). Therefore, when storing data, consider whether you need to keep the string representation... 👇 example in link below

mattkingshott's tweet image. #Laravel Tip:

Queries that need to examine string columns will always be slower than integer columns (even when indexed). Therefore, when storing data, consider whether you need to keep the string representation...

👇 example in link below

Laravel Pro Tips รีโพสต์แล้ว

🔥 Laravel tip: Remember to use bindings in your raw queries. You can pass an array of bindings to most raw query methods to avoid SQL injection. #php #laravel #sql #AI #Java #javascript #100DaysOfCode #learning #web3 #webdevelopment #freelancer #مطور_ويب

devThaer's tweet image. 🔥 Laravel tip: Remember to use bindings in your raw queries.

You can pass an array of bindings to most raw query methods to avoid SQL injection. 

#php #laravel #sql #AI #Java #javascript #100DaysOfCode #learning #web3 #webdevelopment #freelancer #مطور_ويب

Laravel Pro Tips รีโพสต์แล้ว

🔥 #Laravel Tip: Eager-loading your data is a very important, but don’t forget to add constraints to your eager loading queries so that they don’t pull in lots of data that you don’t need.

mattkingshott's tweet image. 🔥 #Laravel Tip: Eager-loading your data is a very important, but don’t forget to add constraints to your eager loading queries so that they don’t pull in lots of data that you don’t need.

Laravel Pro Tips รีโพสต์แล้ว

🔥 #Laravel Tip: Knowing the difference between calling ‘fresh’ or ‘refresh’ on a model is quite important. If you’re new to the framework, then here’s a simple explanation on how they differ.

mattkingshott's tweet image. 🔥 #Laravel Tip: Knowing the difference between calling ‘fresh’ or ‘refresh’ on a model is quite important. If you’re new to the framework, then here’s a simple explanation on how they differ.

Laravel Pro Tips รีโพสต์แล้ว

🔥 #Laravel Tip: Eloquent's 'whereExists' method is useful, but it relies on sub queries. A more efficient way to run the same query is an advanced inner join.

mattkingshott's tweet image. 🔥 #Laravel Tip: Eloquent's 'whereExists' method is useful, but it relies on sub queries. A more efficient way to run the same query is an advanced inner join.

Laravel Pro Tips รีโพสต์แล้ว

🔥 Laravel Tip: Auto-completion in artisan commands. When you prompt a user for input, you can use the `anticipate` method to auto-complete possible responses.

cosmeescobedo's tweet image. 🔥 Laravel Tip: Auto-completion in artisan commands.

When you prompt a user for input, you can use the `anticipate` method to auto-complete possible responses.

Laravel Pro Tips รีโพสต์แล้ว

🔥 #Laravel Tip: Seeding your database one record at a time can slow the DB to a halt. A better option is to use PHP to make a bunch of records and then seed them in chunks. Here’s how you can go from 10,000 queries to 5!

mattkingshott's tweet image. 🔥 #Laravel Tip: Seeding your database one record at a time can slow the DB to a halt. A better option is to use PHP to make a bunch of records and then seed them in chunks. Here’s how you can go from 10,000 queries to 5!

Laravel Pro Tips รีโพสต์แล้ว

🔥 #Laravel Tip: Eloquent’s ‘whereDate’ function is useful, but it prevents the database from using an index, which can effect performance on large tables. Fortunately, it is easy to replace it with ‘whereBetween’:

mattkingshott's tweet image. 🔥 #Laravel Tip: Eloquent’s ‘whereDate’ function is useful, but it prevents the database from using an index, which can effect performance on large tables. Fortunately, it is easy to replace it with ‘whereBetween’:

Laravel Pro Tips รีโพสต์แล้ว

🔥 #Laravel Tip: Eloquent provides a ‘withCount’ method, but it uses a sub-query, which can be up to 8 times slower (or more in some cases) than using a leftJoin & groupBy. Refactoring only requires a few changes and can make a big difference…

mattkingshott's tweet image. 🔥 #Laravel Tip: Eloquent provides a ‘withCount’ method, but it uses a sub-query, which can be up to 8 times slower (or more in some cases) than using a leftJoin & groupBy. Refactoring only requires a few changes and can make a big difference…

Laravel Pro Tips รีโพสต์แล้ว

😍 You can retrieve date from request in specific format and timezone 🤯 #laravel #laraveltips #laraveltricks #laravelforever

laravel_updates's tweet image. 😍 You can retrieve date from request in specific format and timezone 🤯

#laravel #laraveltips #laraveltricks #laravelforever

Laravel Pro Tips รีโพสต์แล้ว

Laravel tip 💡You can use the 'resolveRouteBinding' method on your model to modify the value that is used to resolve the binding.

Philo01's tweet image. Laravel tip 💡You can use the 'resolveRouteBinding' method on your model to modify the value that is used to resolve the binding.

Loading...

Something went wrong.


Something went wrong.