Esempio n. 1
0
 /**
  * Register the router.
  *
  * @return void
  */
 protected function registerRouter()
 {
     $this->app->singleton('api.router', function ($app) {
         $config = $app['config'];
         $router = new Router($app['Sunel\\Api\\Http\\Parser\\Accept'], $app['api.exception'], $app, $config['domain'], $config['prefix']);
         $router->setConditionalRequest($config['conditionalRequest']);
         return $router;
     });
 }
Esempio n. 2
0
 /**
  * Perform authentication before a request is executed.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure                 $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next, $provider = [])
 {
     $route = $this->router->getCurrentRoute();
     if (!is_array($provider)) {
         $provider = explode(',', $provider);
     }
     if (!$this->auth->check(false)) {
         $this->auth->authenticate($provider);
     }
     return $next($request);
 }