Eloquent query not working Laravel 5.4 -


i have following query , not working expected.

$students = studentstatus::with(['user.studentprogramme' => function ($query) {                                 $query->where('department_course_id', request('studycourse'));                             }], 'level', 'user.studentprogramme.course')                             ->where('level_id', request('level'))                             ->where('status', 0)                             ->get(); 

the inner where, $query->where('department_course_id', request('studycourse')) ignored , don't know why.

is there missing out?

this may scope issue try:

$studycourse = ;  $students = studentstatus::with(['user' => function($query) {                             $query->with(['studentprogramme' => function ($query) {                                 $query->where('department_course_id', request('studycourse'));                             }]}], 'level', 'user.studentprogramme.course')                             ->where('level_id', request('level'))                             ->where('status', 0)                             ->get(); 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -