-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added Laravel Telescope for local development
- Loading branch information
1 parent
f839c71
commit dc8428c
Showing
11 changed files
with
385 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace App\Providers; | ||
|
||
use Illuminate\Support\Facades\Gate; | ||
use Laravel\Telescope\IncomingEntry; | ||
use Laravel\Telescope\Telescope; | ||
use Laravel\Telescope\TelescopeApplicationServiceProvider; | ||
|
||
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider | ||
{ | ||
/** | ||
* Register any application services. | ||
*/ | ||
public function register(): void | ||
{ | ||
// Telescope::night(); | ||
|
||
$this->hideSensitiveRequestDetails(); | ||
|
||
Telescope::filter(function (IncomingEntry $entry) { | ||
if ($this->app->environment('local')) { | ||
return true; | ||
} | ||
|
||
return $entry->isReportableException() || | ||
$entry->isFailedRequest() || | ||
$entry->isFailedJob() || | ||
$entry->isScheduledTask() || | ||
$entry->hasMonitoredTag(); | ||
}); | ||
} | ||
|
||
/** | ||
* Prevent sensitive request details from being logged by Telescope. | ||
*/ | ||
protected function hideSensitiveRequestDetails(): void | ||
{ | ||
if ($this->app->environment('local')) { | ||
return; | ||
} | ||
|
||
Telescope::hideRequestParameters(['_token']); | ||
|
||
Telescope::hideRequestHeaders([ | ||
'cookie', | ||
'x-csrf-token', | ||
'x-xsrf-token', | ||
]); | ||
} | ||
|
||
/** | ||
* Register the Telescope gate. | ||
* | ||
* This gate determines who can access Telescope in non-local environments. | ||
*/ | ||
protected function gate(): void | ||
{ | ||
Gate::define('viewTelescope', function ($user) { | ||
return in_array($user->email, [ | ||
// | ||
]); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.