userable_type == Student::class) { $student = Auth::user()->userable; return Subject::whereIn('id', $student->grade->subjects->pluck('id')) ->filter() ->paginate(5) ->withQueryString(); } return Subject::filter()->paginate(5)->withQueryString(); } }