Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

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()

0

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.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.