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
For Laravel 5.3 and 5.4, here is the proper way to do it:
You have to change:
public function __construct()
{
$this->middleware('guest');
}
to
public function __construct()
{
$this->middleware('auth');
}
in app/Http/Controller/Auth/RegisterController.php
All I did was replace register blade code with login blade code. That way register still goes to login.
resources/views/auth/register.blade.php
is replaced with resources/views/auth/login.blade.php
For Laravel 5.6+, paste the below methods in app\Http\Controller\Auth\RegisterController
/*
* Disabling registeration.
*
*/
public function register()
{
return redirect('/');
}
/*
* Disabling registeration.
*
*/
public function showRegistrationForm()
{
return redirect('/');
}
Now you're overriding those methods in RegistersUser
trait, whenever you change your mind remove these methods. You may also comment the register links in welcome.blade.php
and login.blade.php
views.