Support the ongoing development of →
Database Eloquent
Last updated 8 months ago.

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:


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!

Full Stack Europe

Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 - All rights reserved.