lundi 23 septembre 2019

How to use where clause on multiple nested eager loading in Laravel 5.8.2

I have four tables that are having relationships form the first to the last where users is a parent to village on applicant_id , Village to Cell on village_id , Cell to Sector on cell_id

and my eloquent query is as follows and it works perfectly without a where clause, when where clause is added I get an error: Column not found: 1054 Unknown column 'applicant_id' in 'where clause'

      // joins users , village ,cell and  sector
          $uvcsector = SectorApproval::with('Cell.Village.UserApplicant')
            ->where('applicant_id', 10)
        -> get();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire