芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/vendor/laravel/jetstream/stubs/app/Actions/Jetstream/RemoveTeamMember.php
authorize($user, $team, $teamMember); $this->ensureUserDoesNotOwnTeam($teamMember, $team); $team->removeUser($teamMember); TeamMemberRemoved::dispatch($team, $teamMember); } /** * Authorize that the user can remove the team member. * * @param mixed $user * @param mixed $team * @param mixed $teamMember * @return void */ protected function authorize($user, $team, $teamMember) { if (! Gate::forUser($user)->check('removeTeamMember', $team) && $user->id !== $teamMember->id) { throw new AuthorizationException; } } /** * Ensure that the currently authenticated user does not own the team. * * @param mixed $teamMember * @param mixed $team * @return void */ protected function ensureUserDoesNotOwnTeam($teamMember, $team) { if ($teamMember->id === $team->owner->id) { throw ValidationException::withMessages([ 'team' => [__('You may not leave a team that you created.')], ])->errorBag('removeTeamMember'); } } }