Explore tweets tagged as #laravelTips
Have you ever used the insertGetId() method in Laravel? It allows you to insert a new record into a table and retrieve its ID in a single query #laraveltips
10
27
173
Have you ever used the withCount() method in Laravel? It allows you to retrieve a count of related records without actually loading them. 1 more day until I release my Query Builder & Eloquent course #laraveltips
6
19
150
The whereDate() method in Laravel is an advanced query builder method that can be used to filter records by a specific date or range of dates. 7 days until I release my Query Builder & Eloquent course #laraveltips
4
23
113
๐ก Did you know you can add multiple columns after another one in a single call with Laravel? It's clean, elegant, and keeps your DB tidy. Thanks @PovilasKorop for the tip! #Laravel #PHP #LaravelTips
2
4
44
Use local scopes in your Laravel app to define query constraints that can be applied to any Eloquent query builder instance, instead of repeatedly performing queries. 2 days until I release my Query Builder & Eloquent course #laraveltips
6
18
110
Both the find() method and findOrFail() method are useful for retrieving a single record. However, they return different responses when a record is not found. Which one do you use? 3 days until I release my Query Builder & Eloquent course #laraveltips
5
4
43
Have you ever heard of the toSql() method? It returns the SQL query that would be executed if you ran the Eloquent query. 5 days until I release my Query Builder & Eloquent course #laraveltips
3
6
43
Do you add default attributes at the database level or the Eloquent level? Personally, I prefer the database level because it keeps the schema organized. 4 days until I release my Query Builder & Eloquent course #laraveltips
10
4
51
๐ฅ Using #Laravel Dusk You can test for JavaScript errors on a page by calling the assertSourceHas method with the </script> tag as the parameter. If the page contains any JS errors, this assertion will fail. #LaravelTips #LaravelTricks #PHP #LaravelDusk
1
9
36
๐ The pruning() method in Laravel runs right before a Prunable model gets deleted. Perfect for cleaning up files or related data ahead of delete(). In this case, it deletes the file linked to an old Invoice. #Laravel #PHP #LaravelTips
0
11
62
Code smell โ error โ but it slows you & your team down. From long methods to tight coupling, here are 5 PHP code smells + how to fix them ๐ง Got a pet peeve we missed? Drop it ๐ #PHPDev #CleanCode #LaravelTips #Refactoring #chilliapple
0
0
0
New video on @laravelnews ! Learn how to use AsArrayObject and AsCollection and improve your JSON data handling! #laravel #laraveltips
2
12
43
Optimize Your Laravel Factories! โก Go over the recycle method with @โharrisrafto to: ๐ฏ Reuse models across factories ๐ Perfect for complex test data โจ Improve testing performance Give us a โค๏ธ if this helped, and follow for more Laravel tips! #laravel #laraveltips
0
5
58
๐กIn #Laravel You can use same Form Request class for Multiple Actions of controller by using in the match or switch case in "rules" method. #LaravelTips #LaravelTricks #PHP
12
60
245
Did you know, that replicate method lets you create an unsaved model, enabling seamless chaining of your favourite model methods. ๐จ For instance, effortlessly copy a model and append "(copy)" to the title for easy identification. Your models, your rules! ๐ป๐ #LaravelTips #PHP
0
0
3
Laravel devs, this oneโs a life-saver: ๐ ๏ธ Whatโs your favorite Laravel hack? #LaravelTips #PHP #DevLife
0
0
1
Laravel Validator can also be used to validate command arguments. The following is a straightforward example #laravel #laravelTips #dataValidation #command
0
15
60