Laravel trick. Use `whereHas()` combined with `orDoesntHave()` to build flexible Eloquent queries that filter models by relationship existence and specific conditions simultaneously.
Laravel trick. Need parent loop info in a nested Blade `@foreach`? Use `$loop->parent` to access the outer loop's iteration counter and other `$loop` properties directly.
Laravel Daily
Laravel trick. Use `whereHas()` combined with `orDoesntHave()` to build flexible Eloquent queries that filter models by relationship existence and specific conditions simultaneously.
18 hours ago | [YT] | 178
View 4 replies
Laravel Daily
Laravel tip.
Date validation rules recognize human-readable keywords: `now`, `today`, `yesterday`, `tomorrow`. Write simpler validation rules with `after`, `before`, `date_equals` without touching Carbon.
1 day ago | [YT] | 361
View 6 replies
Laravel Daily
Quick Laravel tip.
Laravel's `withDefault()` method on `belongsTo` relationships provides fallback data when related models don't exist.
No more null reference exceptions in your Blade templates when accessing missing relationships.
2 days ago | [YT] | 271
View 12 replies
Laravel Daily
Laravel tip. Laravel 9+ lets you replace `redirect()->route()` with the cleaner `to_route()` helper.
1 week ago | [YT] | 334
View 12 replies
Laravel Daily
Your opinions on Laravel tools releases of 2025? Fill in the survey and I'll shoot a video with results: docs.google.com/forms/d/e/1FAIpQLScGPsfSCUcX9O-b2q…
Share if you're (happily?) using tools like:
- Starter kits
- Cloud
- Nightwatch
- Forge 2.0
- Boost
- Wayfinder
- Anything I've missed?
1 week ago | [YT] | 69
View 9 replies
Laravel Daily
Laravel trick. Need parent loop info in a nested Blade `@foreach`?
Use `$loop->parent` to access the outer loop's iteration counter and other `$loop` properties directly.
1 week ago | [YT] | 430
View 5 replies
Laravel Daily
Laravel tip.
Eloquent `whereRelation()` is a shorter way to write `whereHas()` with a simple condition inside.
1 week ago | [YT] | 600
View 11 replies
Laravel Daily
Do you prefer PHP functions or Laravel helpers?
Here's an example of Str helper.
A or B?
3 weeks ago | [YT] | 507
View 63 replies
Laravel Daily
Laravel/PHP tip.
Did you know Faker method `bothify()`?
- ? characters are replaced with a random letter
- # characters - with a random digit
- * characters - with either a random letter or a random digit
Example for car plate numbers.
Link to docs: fakerphp.org/formatters/numbers-and-strings/#bothi…
1 month ago | [YT] | 567
View 10 replies
Laravel Daily
Confession: I changed my mind on obvious code comments.
Earlier me: why you write the obvious comment and waste one line?
Current me: I like this code. It's easy to read. It can breathe. My eyes are happy. They can *skim* this code easier.
Or maybe I'm just getting old? :)
1 month ago | [YT] | 296
View 43 replies
Load more