diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index bb4bbe28..7bf18d0a 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -2,20 +2,18 @@ namespace App\Actions\Fortify; -use App\Models\Team; use App\Models\User; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; +use Illuminate\Validation\Rule; use Laravel\Fortify\Contracts\CreatesNewUsers; -use Laravel\Jetstream\Jetstream; class CreateNewUser implements CreatesNewUsers { use PasswordValidationRules; /** - * Create a newly registered user. + * Validate and create a newly registered user. * * @param array $input */ @@ -23,31 +21,20 @@ public function create(array $input): User { Validator::make($input, [ 'name' => ['required', 'string', 'max:255'], - 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], + 'email' => [ + 'required', + 'string', + 'email', + 'max:255', + Rule::unique(User::class), + ], 'password' => $this->passwordRules(), - 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '', ])->validate(); - 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); - }); - }); - } - - /** - * Create a personal team for the user. - */ - protected function createTeam(User $user): void - { - $user->ownedTeams()->save(Team::forceCreate([ - 'user_id' => $user->id, - 'name' => explode(' ', $user->name, 2)[0]."'s Team", - 'personal_team' => true, - ])); + return User::create([ + 'name' => $input['name'], + 'email' => $input['email'], + 'password' => Hash::make($input['password']), + ]); } } diff --git a/app/Actions/Fortify/UpdateUserProfileInformation.php b/app/Actions/Fortify/UpdateUserProfileInformation.php index 9738772d..0930ddf3 100644 --- a/app/Actions/Fortify/UpdateUserProfileInformation.php +++ b/app/Actions/Fortify/UpdateUserProfileInformation.php @@ -13,19 +13,21 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation /** * Validate and update the given user's profile information. * - * @param array $input + * @param array $input */ public function update(User $user, array $input): void { Validator::make($input, [ 'name' => ['required', 'string', 'max:255'], - 'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)], - 'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'], - ])->validateWithBag('updateProfileInformation'); - if (isset($input['photo'])) { - $user->updateProfilePhoto($input['photo']); - } + 'email' => [ + 'required', + 'string', + 'email', + 'max:255', + Rule::unique('users')->ignore($user->id), + ], + ])->validateWithBag('updateProfileInformation'); if ($input['email'] !== $user->email && $user instanceof MustVerifyEmail) { diff --git a/config/app.php b/config/app.php index 66a1976b..5a9d1c1c 100644 --- a/config/app.php +++ b/config/app.php @@ -160,6 +160,7 @@ * Package Service Providers... */ JoelButcher\Socialstream\Filament\SocialstreamPanelProvider::class, + JoelButcher\Socialstream\Filament\SocialstreamPanelProvider::class, /* * Application Service Providers... diff --git a/config/fortify.php b/config/fortify.php index 0551d1d6..726d83bb 100644 --- a/config/fortify.php +++ b/config/fortify.php @@ -146,7 +146,7 @@ 'features' => [ Features::registration(), Features::resetPasswords(), - Features::emailVerification(), + // Features::emailVerification(), Features::updateProfileInformation(), Features::updatePasswords(), Features::twoFactorAuthentication([ diff --git a/config/jetstream.php b/config/jetstream.php index 7782d051..a90b5a07 100644 --- a/config/jetstream.php +++ b/config/jetstream.php @@ -16,7 +16,7 @@ | */ - 'stack' => 'livewire', + 'stack' => 'inertia', /* |-------------------------------------------------------------------------- @@ -60,8 +60,8 @@ 'features' => [ // Features::termsAndPrivacyPolicy(), // Features::profilePhotos(), - Features::api(), - Features::teams(['invitations' => true]), + // Features::api(), + // Features::teams(['invitations' => true]), Features::accountDeletion(), ], diff --git a/package-lock.json b/package-lock.json index f0cbf3c5..e2906d6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "boilerplate-laravel", + "name": "billing-laravel", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/routes/web.php b/routes/web.php index 623d6cf1..7af8f34b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -26,4 +26,4 @@ Route::get('/team-invitations/{invitation}', [TeamInvitationController::class, 'accept']) ->middleware(['signed', 'verified', 'auth', AuthenticateSession::class]) ->name('team-invitations.accept'); -require __DIR__.'/socialstream.php'; \ No newline at end of file +require __DIR__.'/socialstream.php';require __DIR__.'/socialstream.php'; \ No newline at end of file