This is
Laravel
In
Auth\Guard
's constructor:
/** * Create a new authentication guard. * * @param \Illuminate\Auth\UserProviderInterface $provider * @param \Illuminate\Session\Store $session * @param \Symfony\Component\HttpFoundation\Request $request * @return void */ public function __construct(UserProviderInterface $provider, SessionStore $session, Request $request = null) { $this->session = $session; $this->request = $request; $this->provider = $provider; }
Where parameters are passed inSessionStore $session
However session
, the constructor is this:
public function __construct($name, SessionHandlerInterface $handler, $id = null) { $this->setId($id); $this->name = $name; $this->handler = $handler; $this->metaBag = new MetadataBag; }
Here is the parameter, why Guard
the constructor can be generated automatically session
?
Was it provided by the php
native or was it Laravel
provided?
Reply content:
This is Laravel
the Auth\Guard
constructor in:
/** * Create a new authentication guard. * * @param \Illuminate\Auth\UserProviderInterface $provider * @param \Illuminate\Session\Store $session * @param \Symfony\Component\HttpFoundation\Request $request * @return void */ public function __construct(UserProviderInterface $provider, SessionStore $session, Request $request = null) { $this->session = $session; $this->request = $request; $this->provider = $provider; }
Where parameters are passed inSessionStore $session
However session
, the constructor is this:
public function __construct($name, SessionHandlerInterface $handler, $id = null) { $this->setId($id); $this->name = $name; $this->handler = $handler; $this->metaBag = new MetadataBag; }
Here is the parameter, why Guard
the constructor can be generated automatically session
?
Was it provided by the php
native or was it Laravel
provided?
Https://github.com/laravel/framework/blob/4.2/src/Illuminate/Auth/AuthManager.php#L51
/** * Create an instance of the Eloquent driver. * * @return \Illuminate\Auth\Guard */public function createEloquentDriver(){ $provider = $this->createEloquentProvider(); return new Guard($provider, $this->app['session.store']);}