return $this->hasManyThrough(
'App\Owner',
'App\Car',
'mechanic_id', // Foreign key on cars table...
'car_id', // Foreign key on owners table...
'id', // Local key on mechanics table...
'id' // Local key on cars table...
);
public function owner(){
return $this->belongsTo('App\Owner');
}
public function cars(){
return $this->hasMany('App\Car');
}
Model::with('owner.cars')