alexa

How user is logged in after registeration automatically in laravel anyone ?

How user is logged in after registeration automatically in laravel anyone ?

You can use laravel/ui package or you can get the logged in user after registration like the following.

 public function register(Request $request)
{
    $this->validator($request->all())->validate();
    event(new Registered($user = $this->create($request->all())));
    $this->guard()->login($user);

    Auth::loginUsingId($user->id);

    if ($response = $this->registered($request, $user)) {
        return $response;
    }

    return $request->wantsJson()
        ? new JsonResponse([], 201)
        : redirect($this->redirectPath());
}

893 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online

Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry