So if you want to use scope queries you can't have a conflicting function name.
When you created scopeWaiting
laravel treats that as waiting()
. Unfortunately, there is a naming conflict there.
Perhaps change your scope query to scopeIsWaiting
and then you can call it like User::is_waiting()->get()
I've come across this a couple of times, in most cases I have other where clauses or joins included in my query so I append the scope call to these further down the chain:
User::where('x', $y)->waiting()->get()
If you have no other clauses to attach to the query then you could do this:
User::query()->waiting()->get()
Looking at some of the cashier source code it doesn't look like they ever call the scope as the first clause it's always further down the chain.
Hope this helps.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community