Recently I install laravel 8. I am trying to disable registration. In laravel 7 "Auth::routes(['register' => false]);" it's work. But laravel 8 it's not working.
Recently I install laravel 8. I am trying to disable registration. In laravel 7 "Auth::routes(['register' => false]);" it's work. But laravel 8 it's not working.
You could try this it's work for me.
Add these routes just below the Auth::routes() to override the default registration routes. Any request to the /register route will redirect to the baseUrl.
Route::match(['get', 'post'], 'register', function(){
return redirect('/');
});
To disable registration in Laravel 8, remove the line Features::registration() or comment out the Feature in the app/config/fortify.php file
'features' => [
// Features::registration(),
Features::resetPasswords(),
// Features::emailVerification(),
Features::updateProfileInformation(),
Features::updatePasswords(),
Features::twoFactorAuthentication([
'confirmPassword' => true,
]),
],
For Laravel Breeze. Just remove or comment this lines in routes/auth.php
Route::get('/register', [RegisteredUserController::class, 'create'])
->middleware('guest')
->name('register');
Route::post('/register', [RegisteredUserController::class, 'store'])
->middleware('guest');
Add this to your route
Route::match(['get', 'post'], 'register', function () {
abort(404);
});