Laravel Pro Tips
@LaravelProTips
The best and hottest tips for Laravel developers. Search or browse to level up your dev work.
คุณอาจชื่นชอบ
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?
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:
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
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 💅
🌟 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!
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 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 👇
Need to know the transfer time of a HTTP post in #Laravel or Guzzle? Use this method to get that info!
I personally think that Cache is a overlooked topic in Laravel, therefore I decided to write an article about it :) blog.codewithdary.com/everything-you…
blog.codewithdary.com
Everything you need to learn about Cache in Laravel — Code With Dary
Within Laravel applications, the cache is the act of transparently storing data for future use in an attempt to make applications run faster.
#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 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 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 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 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 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 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 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 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…
😍 You can retrieve date from request in specific format and timezone 🤯 #laravel #laraveltips #laraveltricks #laravelforever
Laravel tip 💡You can use the 'resolveRouteBinding' method on your model to modify the value that is used to resolve the binding.
United States เทรนด์
- 1. RIP Beef N/A
- 2. #HardRockBet 4,026 posts
- 3. SNAP 655K posts
- 4. Jamaica 89.5K posts
- 5. #IDontWantToOverreactBUT 5,835 posts
- 6. #MondayMotivation 43.1K posts
- 7. McCreary 1,960 posts
- 8. MRIs 2,532 posts
- 9. $ZOOZ 4,945 posts
- 10. #ChelleyxTrueReligion 3,011 posts
- 11. Friendly 53.8K posts
- 12. Chapman 3,586 posts
- 13. John Dickerson 1,082 posts
- 14. Hurricane Melissa 54.3K posts
- 15. #Dandadan215 N/A
- 16. Berghain 43K posts
- 17. DNCE Halloween N/A
- 18. jungkook 372K posts
- 19. Stephen King 5,131 posts
- 20. $QCOM 18.1K posts
คุณอาจชื่นชอบ
-
MadeWithLaravel
@MadeWithLaravel -
Laravel Idea
@laravel_idea -
Ash Allen 🚀
@AshAllenDesign -
Best of Laravel
@BestOfLaravel -
Pascal Baljet
@pascalbaljet -
Dary
@codewithdary -
Philo Hermans
@Philo01 -
Shift
@laravelshift -
Livewire
@LaravelLivewire -
PEST
@pestphp -
PHP Guus
@PHPGuus -
Tobias_Petry.sql
@tobias_petry -
Andrew Schmelyun
@aschmelyun -
Laravel News Links
@LaravelLinks -
JustSteveKing
@JustSteveKing
Something went wrong.
Something went wrong.