skip to Main Content

Laravel where condition within 'with'

I have an eloquent query: $cameras=Jump::Video() ->with('flight','flight.aircraft','flight.airfield') ->with('student','student.logininfo','student.logininfo.reservations') ->with('camera','camera.status') ->whereBetween('data',[ $from, $to]) ->orderBy($sortBy, $orderDesc) ->paginate($request->perPage); and relations between student, logininfo and reservations Model Jump.php public function scopeVideo($query) { return $query->where('exercise', '104'); } public function student() { return $this->hasOne('AppModelsPersonalData','id','student'); } Model…

VIEW QUESTION
Back To Top
Search