I'm learning eloquent relationship on Laravel and i got question on the hasonethrough
by using the same table design as Laravel's docs
tables
mechanics (id, name)
cars (id, model, mechanic_id)
owners (id, name, car_id)
then I define the relationship at the mechanic model to access car owner
class Mechanic extends Model
{
public function carOwner() {
return $this->hasOneThrough('App\Owner', 'App\Car');
}
}
this will return
array:4 [▼
"id" => 1
"name" => "Ricky"
"car_id" => 1
"laravel_through_key" => 1
]
my question is can I get the car model using my hasOnethrough
relation ?