skip to Main Content

use relations in scopes in laravel

I Want To Use Relation Methods In Scopes But It Gives an Error. Error: Call to undefined method IlluminateDatabaseEloquentBuilder::members() Controller: $members = $book->MembersLoanedCurrentBook()->paginate(8); Scope: public function scopeMembersLoanedCurrentBook(Builder $query): Builder { return $query->members()->orderBy('return_date')->where('book_member.returned',false); }

VIEW QUESTION
Back To Top
Search