Laravel 5.4 Disable Register Route

前端 未结 13 2323
旧时难觅i
旧时难觅i 2020-12-13 00:09

I am trying to disable the register route on my application which is running in Laravel 5.4.

In my routes file, I have only the

Auth::routes();
         


        
13条回答
  •  南方客
    南方客 (楼主)
    2020-12-13 00:44

    Though the above solutions work but, I think changing the middleware to 'auth' in the App\Http\Controllers\Auth\RegisterController will be one of the easiest solutions. This will redirect all visitors to login page if they want to access any of the registration routes. Like this:

    namespace App\Http\Controllers\Auth;
    class RegisterController extends Controller
    {
        public function __construct()
        {
            $this->middleware('auth');
        }
    

提交回复
热议问题