Relative Content

Tag Archive for laraveleloquentnest

How do I call parent id into with() where() condition when using eloquent eager loading?

$data = SELF::select(‘id’,’super_parent_id’,’name’,status) ->with([‘table_three’=>function($qry2) { $qry2->where(‘super_parent_id’, ‘pointer to super_parent_id’); };])->get()->toArray(); I try the code and expect it to point to its immediate previous parent. I done declaring all the relation. it says column not found. i checked yes the column exhist. laravel eloquent nest

I know this stupid, but how do I call parent id into with() where() condition when using eloquent eager loading?

$data = SELF::select(‘id’,’super_parent_id’,’name’,status) ->with([‘table_three’=>function($qry2) use ($bajetMain) { $qry2->where(‘super_parent_id’, ‘pointer to super_parent_id’); };])->get()->toArray(); I try the code and expect it to point to its immediate previous parent. I done declaring all the relation. it says column not found. i checked yes the column exhist. laravel eloquent nest