Esempio n. 1
0
 /**
  * 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 TokenMismatchException) {
         //redirect to form an example of how I handle minedd
         return redirect()->to('/')->with('message', "Opps! Seems you couldn't submit form for a longtime. Please try again");
     }
     if ($this->isHttpException($e)) {
         switch ($e->getStatusCode()) {
             case 404:
                 $url = explode('/', \Request::url());
                 $referidos = User::where('type', '=', 'referrer')->get();
                 foreach ($referidos as $referido) {
                     if ($referido->code_referrer == $url[3]) {
                         return redirect()->route('site.singUp', [$referido->code_referrer]);
                     }
                 }
                 return redirect()->to('/404');
                 break;
                 // internal error
             // internal error
             case '500':
                 return redirect()->guest('/500');
                 break;
             default:
                 return $this->renderHttpException($e);
                 break;
         }
     } else {
         return parent::render($request, $e);
     }
 }
Esempio n. 2
0
 public function searchUser(Request $request)
 {
     $datos = User::where('user', '=', $request->get('dato'))->get();
     return json_encode($datos);
 }