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

Yes you are using scopes wrong. Scopes receive the current query builder and return the builder. You are creating a new query builder. If you look at the docs you will see all the examples for local scopes receive a $query variable and call methods on that $query variable.

public function scopeNotDefault($query) {
    return $query->where('pp_id', '!=', 1);
}
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

Nertskull nertskull Joined 3 Apr 2015

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.

© 2023 Laravel.io - All rights reserved.