Level 102
most likely you have a method called agency().
Start the query with starting the query builder
Customer::query()->agency()->phone($search)->get();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am using query scope its working fine when I use it like
Customer::phone($search)->agency()->get();
but give error when using agency scope first error: Non-static method App\Models\Customer::agency() cannot be called statically
Customer::agency()->phone($search)->get();
public function scopeAgency($query)
{
return $query->where('agency_id', session('agency_id'));
}
public function scopePhone($query, $search)
{
return $query->where('phone_no', 'like', '%' . $search . '%');
}
most likely you have a method called agency().
Start the query with starting the query builder
Customer::query()->agency()->phone($search)->get();
Please or to participate in this conversation.