protected function shouldPassThrough($request) { foreach ($this->except as $except) { if ($request->is($except)) { return true; } } if (DarkShare::isApi()) { return true; } return false; }
/** * Define the routes for the application. * * @param \Illuminate\Routing\Router $router * @return void */ public function map(Router $router) { if (DarkShare::isApi()) { $router->group(['namespace' => $this->apiNamespace], function ($router) { require app_path('Http/routes-api.php'); }); } else { $router->group(['namespace' => $this->adminNamespace], function ($router) { require app_path('Http/routes-admin.php'); }); $router->group(['namespace' => $this->namespace], function ($router) { require app_path('Http/routes.php'); }); } }
/** * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request * @param \Exception $e * @return \Illuminate\Http\Response */ public function render($request, Exception $e) { if ($e instanceof FileException) { flash()->error($e->getMessage()); return redirect()->back(); } if ($e instanceof ModelNotFoundException) { if (DarkShare::isApi()) { return "Submission not found." . PHP_EOL; } flash()->error("Sorry, couldn't find that Submission..."); return redirect()->home(); } if ($e instanceof TooManySubmissionsException) { if (DarkShare::isApi()) { return redirect()->route('api.limit'); } flash()->error($e->getMessage()); return redirect()->home(); } return parent::render($request, $e); }