lundi 8 mai 2017

How $this->guard()->login($user); laravel method situated in `trait RegistersUsers` works actually?

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

        event(new Registered($user = $this->create($request->all())));

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

        return $this->registered($request, $user)
                        ?: redirect($this->redirectPath());
    }

    /**
     * Get the guard to be used during registration.
     *
     * @return \Illuminate\Contracts\Auth\StatefulGuard
     */
    protected function guard()
    {
        return Auth::guard();
    }

This is a laravel user register code. My Problem is what the

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

method return? I think it firstly returns web guard and then call login($user) using that guard. But problem is how it calls login($user) method that is situated in another trait from this trait using this web guard??
How does it do this actually?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire