-
-
Save tmanOC/2ce12e2cdf8c5d9d82e9167f8e66ee40 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