How to override registration function in Laravel 5

I am trying to override the registration function in Laravel 5 following the suggestion in this question. In my case, however, I am not trying to redirect users from the registration page. Rather, I would just like to register a new user, but keep the current user (administrator) logged in. The function checks by default, then logs in a new user and then redirects to "home". So here is what I tried to add to AuthController.php:

// OVERRIDE FUNCTION IN AuthenticatesAndRegistersUsers (located under /Illuminate/Foundation/Auth)
public function postRegister(Request $request) {
    $validator = $this->registrar->validator($request->all());

    if ($validator->fails())
    {
        $this->throwValidationException(
            $request, $validator
        );
    }

    //$this->auth->login($this->registrar->create($request->all()));
    $this->registrar->create($request->all());

    return redirect('admin');
}

, , . . !

+4
4

, "create" , : "", :

User::create($data = array());

User. :

return redirect('admin');

. .

+1

: , postRegister?

.

+1

I have the same problem, can someone give a solution

0
source

I think I found the answer, (in my case). I copied the registration function and forgot to delete the verified verification email

0
source

All Articles