Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Local and Global Scopes for Repeating Conditions

Premium
4:15

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

J
jacm ✓ Link copied!

Hello, how to handle local scope when there are NO records? the builder returns an object, don't return null or empty collection for one on the controller/component side do some if condition to handle cases when there is or isn't records....currently in my component in the livewire mount I use a local scope that when there are records it works perfect but when there aren't it it crashes for that builder object (when no records).

PK
Povilas Korop ✓ Link copied!

Very hard to answer without a specific code example and cases when it crashes or not. Needs debugging.