Thursday, March 30, 2017

When selecting specific columns within eager loading (selecting foreign key is necessary)

`->with('category')
->with(['campaignData'=>function($query){
        $query->addSelect(['id','partners','customers']);
     }])
->with('type')`

I wanted to retrieve just 'partners' and 'customers' but to retrieve only those two, selection of foreign key also required



via lakmalsathyajith

Advertisement