Skip to content

Commit

Permalink
Send to register page when there are not account
Browse files Browse the repository at this point in the history
  • Loading branch information
Sander0542 committed Dec 24, 2021
1 parent ddd2d60 commit 8f82a93
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/Providers/JetstreamServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
namespace App\Providers;

use App\Actions\Jetstream\DeleteUser;
use App\Models\User;
use Illuminate\Support\ServiceProvider;
use Inertia\Inertia;
use Laravel\Fortify\Fortify;
use Laravel\Jetstream\Jetstream;

class JetstreamServiceProvider extends ServiceProvider
Expand All @@ -28,6 +31,17 @@ public function boot()
$this->configurePermissions();

Jetstream::deleteUsersUsing(DeleteUser::class);

Fortify::loginView(function () {
if (User::count(['id']) > 0) {
return Inertia::render('Auth/Login', [
'canResetPassword' => \Route::has('password.request'),
'status' => session('status'),
]);
}

return redirect()->route('register');
});
}

/**
Expand Down

0 comments on commit 8f82a93

Please sign in to comment.