/**
  * Register a new callback based request guard.
  *
  * @param  string  $driver
  * @param  callable  $callback
  * @return $this
  */
 public function viaRequest($driver, callable $callback)
 {
     return $this->extend($driver, function () use($callback) {
         $guard = new RequestGuard($callback, $this->app['request']);
         $this->app->refresh('request', $guard, 'setRequest');
         return $guard;
     });
 }
Exemple #2
0
 /**
  * Create a session based authentication guard.
  *
  * @param  string  $name
  * @param  array  $config
  * @return \Illuminate\Auth\SessionGuard
  */
 public function createSessionDriver($name, $config)
 {
     $provider = $this->createUserProvider($config['source']);
     $guard = new SessionGuard($name, $provider, $this->app['session.store']);
     // When using the remember me functionality of the authentication services we
     // will need to be set the encryption instance of the guard, which allows
     // secure, encrypted cookie values to get generated for those cookies.
     if (method_exists($guard, 'setCookieJar')) {
         $guard->setCookieJar($this->app['cookie']);
     }
     if (method_exists($guard, 'setDispatcher')) {
         $guard->setDispatcher($this->app['events']);
     }
     if (method_exists($guard, 'setRequest')) {
         $guard->setRequest($this->app->refresh('request', $guard, 'setRequest'));
     }
     return $guard;
 }
Exemple #3
0
 /**
  * Refresh an instance on the given target and method.
  *
  * @param string $abstract
  * @param mixed $target
  * @param string $method
  * @return mixed 
  * @static 
  */
 public static function refresh($abstract, $target, $method)
 {
     //Method inherited from \Illuminate\Container\Container
     return \Illuminate\Foundation\Application::refresh($abstract, $target, $method);
 }