Contract::withPermission($user)->get();
/* User model */
...
public function matches()
{
return $this->hasMany(Match::class, 'user_id', 'id');
}
...
/* Match model */
...
public function user()
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
...
$match = Match::find($id);
$user = $match->user->name;