Dashboard sipadu mbip
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Handler.php 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace App\Exceptions;
  3. use Exception;
  4. use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
  5. class Handler extends ExceptionHandler
  6. {
  7. /**
  8. * A list of the exception types that are not reported.
  9. *
  10. * @var array
  11. */
  12. protected $dontReport = [
  13. //
  14. ];
  15. /**
  16. * A list of the inputs that are never flashed for validation exceptions.
  17. *
  18. * @var array
  19. */
  20. protected $dontFlash = [
  21. 'password',
  22. 'password_confirmation',
  23. ];
  24. /**
  25. * Report or log an exception.
  26. *
  27. * @param \Exception $exception
  28. * @return void
  29. */
  30. public function report(Exception $exception)
  31. {
  32. parent::report($exception);
  33. }
  34. /**
  35. * Render an exception into an HTTP response.
  36. *
  37. * @param \Illuminate\Http\Request $request
  38. * @param \Exception $exception
  39. * @return \Illuminate\Http\Response
  40. */
  41. public function render($request, Exception $exception)
  42. {
  43. if ($exception instanceof ModelNotFoundException) {
  44. return response()->view('errors.' . '404', [], 404);
  45. }
  46. if ($exception instanceof CustomException) {
  47. return response()->view('errors.' . '500', [], 500);
  48. }
  49. if($this->isHttpException($exception)) {
  50. switch ($exception->getStatusCode()) {
  51. // not found
  52. case '404':
  53. return response()->view('errors.' . '404', [], 404);
  54. break;
  55. // internal server error
  56. case '500':
  57. return response()->view('errors.' . '500', [], 500);
  58. break;
  59. default:
  60. return $this->renderHttpException($exception);
  61. break;
  62. }
  63. } else {
  64. return parent::render($request, $exception);
  65. // return response()->view('errors.' . '500', [], 500);
  66. }
  67. }
  68. }