Nenhuma descrição

TelescopeServiceProvider.php 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Providers;
  3. use Laravel\Telescope\Telescope;
  4. use Illuminate\Support\Facades\Gate;
  5. use Laravel\Telescope\IncomingEntry;
  6. use Laravel\Telescope\TelescopeApplicationServiceProvider;
  7. class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
  8. {
  9. /**
  10. * Register any application services.
  11. *
  12. * @return void
  13. */
  14. public function register()
  15. {
  16. // Telescope::night();
  17. // $this->hideSensitiveRequestDetails();
  18. Telescope::filter(function (IncomingEntry $entry) {
  19. if ($this->app->isLocal()) {
  20. return true;
  21. }
  22. return $entry->isReportableException() ||
  23. $entry->isFailedJob() ||
  24. $entry->isScheduledTask() ||
  25. $entry->hasMonitoredTag();
  26. });
  27. }
  28. /**
  29. * Prevent sensitive request details from being logged by Telescope.
  30. *
  31. * @return void
  32. */
  33. protected function hideSensitiveRequestDetails()
  34. {
  35. if ($this->app->isLocal()) {
  36. return;
  37. }
  38. Telescope::hideRequestParameters(['_token']);
  39. Telescope::hideRequestHeaders([
  40. 'cookie',
  41. 'x-csrf-token',
  42. 'x-xsrf-token',
  43. ]);
  44. }
  45. /**
  46. * Register the Telescope gate.
  47. *
  48. * This gate determines who can access Telescope in non-local environments.
  49. *
  50. * @return void
  51. */
  52. protected function gate()
  53. {
  54. // Gate::define('viewTelescope', function ($user) {
  55. // return in_array($user->email, [
  56. // //
  57. // ]);
  58. // });
  59. }
  60. }