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 Load model I have the following relationship to shipment:
public function shipment(){
return $this->belongsTo(shipment::class, 'shipmentID');
}
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?
Load::with('shipment.shiptoAccount','driver','tractor');?shipmentis as such from myLoadmodel: public function shipment(){ return $this->belongsTo(shipment::class, 'shipmentID'); }'shipment.shiptoAccount','shipment.shipfromAccount', ...or some other way?