Laravel - Do not log in after registration ...?

2

How to remove automatic login after registering?

I've commented the following line from the RegisterUsers file:

public function register(Request $request)
    {
        $validator = $this->validator($request->all());

        if ($validator->fails()) {
            $this->throwValidationException(
                $request, $validator
            );
        }
        //Linha comentada
        //Auth::guard($this->getGuard())->login($this->create($request->all()));

        return redirect($this->redirectPath());
    }

This prevented you from logging in but does not register the user.

I tried to leave only create:

Auth::guard($this->getGuard())->create($request->all());

But it gives the error: 'Call to undefined method Illuminate \ Auth \ SessionGuard :: create ()'.

What do I do?

    
asked by anonymous 01.06.2016 / 16:45

1 answer

3

It would be easier for you to get the model that is responsible for authentication and use the create method.

But I can tell you that in Laravel, the login method is Auth::login() , which is called at the end of your commented line.

In your case, the code that needs to be left to just create the user is just $this->create() .

See:

$this->create($request->all())
    
01.06.2016 / 22:54