89 lines
2.3 KiB
PHP
89 lines
2.3 KiB
PHP
<?php
|
||
|
||
namespace App\Providers;
|
||
|
||
use Illuminate\Support\Facades\Gate;
|
||
use Laravel\Telescope\IncomingEntry;
|
||
use Laravel\Telescope\Telescope;
|
||
use Laravel\Telescope\TelescopeApplicationServiceProvider;
|
||
use App\Models\User;
|
||
use Illuminate\Support\Facades\Auth;
|
||
|
||
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
||
{
|
||
/**
|
||
* Register any application services.
|
||
*/
|
||
public function register(): void
|
||
{
|
||
Telescope::night();
|
||
|
||
$this->hideSensitiveRequestDetails();
|
||
|
||
Telescope::filter(function (IncomingEntry $entry) {
|
||
/*
|
||
$accept = ['PUT', 'DELETE'];
|
||
if ($entry->type === 'request') {
|
||
return in_array($entry->content['method'], $accept);
|
||
}
|
||
|
||
if ($entry->type === 'query') {
|
||
// accept isteği sırasında yapılan sorguları loglamak için ilgili sorguları kontrol edin
|
||
if(isset($entry->content['method'])) {
|
||
return in_array($entry->content['method'], $accept);
|
||
} else {
|
||
return false;
|
||
}
|
||
|
||
}
|
||
*/
|
||
return true;
|
||
/*
|
||
// if ($this->app->environment('production')) {
|
||
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('production')) {
|
||
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, [
|
||
'admin@pelinom.com',
|
||
'stellar',
|
||
]);
|
||
});
|
||
}
|
||
}
|