Skip to main content

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? (30 h 33 min)

You also get:

55 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.

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.