belongsTo(User::class, 'owner'); } public function movies(): BelongsToMany { return $this->belongsToMany(Movie::class); } public function getUserRole($userId) { return $this->collaborators() ->where('user_id', $userId) ->first() ?->pivot ->role; } public function collaborators(): BelongsToMany { return $this->belongsToMany(User::class, 'movie_list_user') ->withPivot('role'); } }