Last active
October 16, 2020 07:56
-
-
Save HristoZA/e87e49e282e69475aec9a31820c75aa4 to your computer and use it in GitHub Desktop.
Eloquent Blog Car
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Car extends Model | |
{ | |
// ... | |
public function garage() | |
{ | |
return $this->belongsTo('App\Garage'); | |
} | |
public function owner() | |
{ | |
return $this->hasOneThrough( | |
'App\Owner', | |
'App\Garage', | |
'id', | |
'id', | |
'garage_id', | |
'owner_id' | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment