コード例 #1
0
ファイル: VerifyCsrfToken.php プロジェクト: elvios/darkshare
 protected function shouldPassThrough($request)
 {
     foreach ($this->except as $except) {
         if ($request->is($except)) {
             return true;
         }
     }
     if (DarkShare::isApi()) {
         return true;
     }
     return false;
 }
コード例 #2
0
 /**
  * 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');
         });
     }
 }
コード例 #3
0
ファイル: Handler.php プロジェクト: elvios/darkshare
 /**
  * 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);
 }