vendredi 31 août 2018

Nested With() in Laravel Model Collection Return

I have a collection that is returned as such:

$scheduleLoads = Load::with('shipment','driver','tractor');

Now, my question is related to the with issue - is there a way to add the relationships of these relationships into my returned collection?

For example:

In the shipment model I have the following relationship:

public function shiptoAccount(){
    return $this->belongsTo('App\Customer', 'ship_to');
}

Is there a way to include the shiptoAccount return of the shipment associated with the Loads collections?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2NBQcdj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire