/** * Customize the roles that may be assigned to team members. * * @return void */ protected function customizeRoles() { Spark::defaultRole('member'); Spark::roles(['admin' => 'Administrator', 'member' => 'Member']); }
/** * Join the team with the given ID. * * @param int $teamId * @return void */ public function joinTeamById($teamId) { $this->teams()->attach([$teamId], ['role' => Spark::defaultRole()]); $this->currentTeam(); event(new JoinedTeam($this, $this->teams()->find($teamId))); }