Handler.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Exceptions;
  3. use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
  4. use Illuminate\Support\Facades\Http;
  5. use Throwable;
  6. class Handler extends ExceptionHandler
  7. {
  8. /**
  9. * A list of the exception types that are not reported.
  10. *
  11. * @var array
  12. */
  13. protected $dontReport = [
  14. //
  15. ];
  16. /**
  17. * A list of the inputs that are never flashed for validation exceptions.
  18. *
  19. * @var array
  20. */
  21. protected $dontFlash = [
  22. 'password',
  23. 'password_confirmation',
  24. ];
  25. /**
  26. * Register the exception handling callbacks for the application.
  27. *
  28. * @return void
  29. */
  30. public function register()
  31. {
  32. $this->reportable(function (Throwable $e) {
  33. try {
  34. $url = config('stag.backendUrl') . '/dev/reportPhpError';
  35. $headers['secret'] = 'superman';
  36. Http::asForm()
  37. ->withHeaders($headers)
  38. ->post($url, [
  39. 'data'=>'LHR: '.$e->getMessage(),
  40. 'secret' => 'superman'
  41. ])
  42. ->json();
  43. }catch(\Exception $e){
  44. //do nothing
  45. }
  46. });
  47. }
  48. }