Handler.php
Go to the documentation of this file.
1 <?php
2 
3 namespace App\Exceptions;
4 
5 use Exception;
10 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
11 
12 class Handler extends ExceptionHandler
13 {
19  protected $dontReport = [
20  AuthorizationException::class,
21  HttpException::class,
22  ModelNotFoundException::class,
23  ValidationException::class,
24  ];
25 
34  public function report(Exception $e)
35  {
36  parent::report($e);
37  }
38 
46  public function render($request, Exception $e)
47  {
48  if ($e instanceof \Illuminate\Session\TokenMismatchException) {
49  return redirect()->back()->with('error', trans('general.token_expired'));
50  }
51 
52  if ($this->isHttpException($e)) {
53 
54  $statusCode = $e->getStatusCode();
55 
56  switch ($statusCode) {
57 
58  case '404':
59  return response()->view('layouts/basic', [
60  'content' => view('errors/404')
61  ]);
62  }
63  }
64 
65  return parent::render($request, $e);
66  }
67 }
report(Exception $e)
Report or log an exception.
Definition: Handler.php:34
render($request, Exception $e)
Render an exception into an HTTP response.
Definition: Handler.php:46