How to authenticate register route in Laravel 8 Jetstream?

Viewed 1231

I want to disable access to register route without login in laravel 8. I am using laravel jetstream with livewire. Here is code in routes\web.php. I have not changed anything in route file.

Route::get('/', function () {
    return view('welcome');
});

Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
    return view('dashboard');
})->name('dashboard');
2 Answers

To disable registration go to config/fortify.php and comment out Features::registration().

'features' => [ 
    //Features::registration(),
    Features::resetPasswords(),
    // Features::emailVerification(),
    Features::updateProfileInformation(),
    Features::updatePasswords(),
    Features::twoFactorAuthentication(), 
],

it work with Fortify you can control its appearance in

 `config/fortify.php    Features::registration(), 

you can customize the register logic validation ... from App\Actions\Fortify CreatesNewUsers

Related