How to disable registration new users in Laravel

后端 未结 27 2887
鱼传尺愫
鱼传尺愫 2020-12-07 10:34

I\'m using Laravel (v5).

I need one user and I\'ve already registered that. Now I want to disable registration for new users. Of course, I need the login form to wor

27条回答
  •  鱼传尺愫
    2020-12-07 11:21

    Overwriting the getRegister and postRegister is tricky - if you are using git there is a high possibility that .gitignore is set to ignore framework files which will lead to the outcome that registration will still be possible in your production environment (if laravel is installed via composer for example)

    Another possibility is using routes.php and adding this line:

    Route::any('/auth/register','HomeController@index');
    

    This way the framework files are left alone and any request will still be redirected away from the Frameworks register module.

提交回复
热议问题