All individual subscriptions are 50% off this week only!

Mego
2 months ago
214
5
Laravel

Disabling auto login user after registration in Laravel 6

Posted 2 months ago by Mego

I am trying to disable auto login of fresh user, after registration. I found a function in trait /vendor/.....RegistersUsers.php on line 60

$this->guard()->login($user);

I don't think, that changing anything in vendor folder is good practise, so I tried to override protected function registered(...) in my app/http/controllers/auth/RegisterController.php

protected function registered(Request $request, $user) { event(new Registered($user));

    //$this->guard()->login($user);
}

But when I run this code, I receive the error

Argument 1 passed to App\Http\Controllers\Auth\RegisterController::registered() must be an instance of App\Http\Controllers\Auth\Request, instance of Illuminate\Http\Request given, called in C:\wamp\www\myproject\vendor\laravel\framework\src\Illuminate\Foundation\Auth\RegistersUsers.php on line 35

How can I disable this "feature"?

Please sign in or create an account to participate in this conversation.