Inside
Post
model
public function user() {
    return $this->belongsTo('App\User');
}
Inside
User
model
public function posts() {
    return $this->hasMany('App\Post');
}
by Valeri Tandilashvili
4 years ago
Laravel
relationships
Laravel From Scratch
1
Pro tip: use ```triple backticks around text``` to write in code fences