This package allows you to disable the personal teams in Laravel Jetstream.
This package requires Laravel 10.x and Jetstream 2.x.
You can install the package via composer:
composer require itbm/laravel-jetstream-disable-personal-team
Update your CreateNewUser.php
file to comment out the personal team creation logic:
return DB::transaction(function () use ($input) {
return tap(User::create([
'name' => $input['name'],
'email' => $input['email'],
'password' => Hash::make($input['password']),
]), function (User $user) {
// $this->createTeam($user);
});
});
Then, edit web.php
and api.php
to include the require-team
middleware included with this package. This will redirect the user to the team creation page if they have not joined a team yet:
Route::middleware([
'auth:sanctum',
config('jetstream.auth_session'),
'verified',
'require-team',
])->group(function () {
// ...
});
You will need to update your AppLayout.vue
file. Find and replace these 2 lines:
<Dropdown v-if="$page.props.jetstream.hasTeamFeatures" align="right" width="60">
<template v-if="$page.props.jetstream.hasTeamFeatures">
with:
<Dropdown v-if="$page.props.jetstream.hasTeamFeatures && $page.props.auth.user.current_team" align="right" width="60">
<template v-if="$page.props.jetstream.hasTeamFeatures && $page.props.auth.user.current_team">
You will need to update your navigation-menu.blade.php
file. Find and replace both instances of this line:
@if (Laravel\Jetstream\Jetstream::hasTeamFeatures())
with:
@if (Laravel\Jetstream\Jetstream::hasTeamFeatures() && Auth::user()->currentTeam)