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

Query Correction of Laravel

I am using this Query. Safety::with( ['imageName'] )->where( ['property_id', '=', $property->property_id ], ['unit_id', '=', $property->unit_id ],['type','=', 'gas' ])->latest()->first(); I am getting error SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'where clause' . Is there any issue in the…

VIEW QUESTION
Back To Top
Search