belongsToMany(Permission::class) ->withTimestamps(); } /** * The teams that that have the role assigned * * @return BelongsToMany */ public function teams() { return $this ->belongsToMany(Team::class) ->withTimestamps(); } /** * The users that that have the role assigned * * @return HasManyDeep */ public function users() { return $this->hasManyDeepFromRelations($this->teams(), (new Team)->users()); } }