Last active
May 20, 2019 17:46
-
-
Save amir9480/d2b3719f53b0d04a9053a0e789d6e308 to your computer and use it in GitHub Desktop.
vasiatlaravel
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 BlogPost extends Model | |
{ | |
protected $with = [ | |
'category' | |
]; | |
/** | |
* Category of this post. | |
* | |
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | |
*/ | |
public function category() | |
{ | |
return $this->belongsTo(BlogCategory::class, 'category_id'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment