$input */ public function create(User $user, array $input): Team { Gate::forUser($user)->authorize('create', Jetstream::newTeamModel()); Validator::make($input, [ 'name' => ['required', 'string', 'max:255'], ])->validateWithBag('createTeam'); AddingTeam::dispatch($user); $user->switchTeam($team = $user->ownedTeams()->create([ 'name' => $input['name'], 'personal_team' => false, ])); return $team; } }