By default, users are joined into their personal team. They can then, via the Dashboard, create additional teams.
The navigational menu has this before allowing the link to be displayed and action to be taken.
@can('create', Laravel\Jetstream\Jetstream::newTeamModel())
@endcan
Looking at the User creation in app/Actions/Fortify/CreateNewUser.php
there is no specific mention of this and all users can create by default.
Looking into the database, there is no specific storage of this either and I can not locate how this @can('create')
is validated in PHP.
Inside of the app/Actions/Jetstream/CreateTeam.php
this is mentioned again:
Gate::forUser($user)->authorize('create', Jetstream::newTeamModel());
But again, no reference to how the validation is done.
How can I disable the ability to create new teams to new registered users in Jetstream?
After using the IRC, a fellow participant enlightened me to the usage of create
which can be found in the app/Policies/TeamPolicy::create
.
This always returns true
thus giving all users the ability, by default, to create new teams.
Solution: return false
instead or do your specific checks in here.
class TeamPolicy
{
use HandlesAuthorization;
// ...
public function create(User $user)
{
return false;
}
// ...
}