Skip to content

Commit 480bc0d

Browse files
committed
Merge branch 'master' into auth
2 parents c0ab040 + 6610710 commit 480bc0d

10 files changed

+363
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
public/vendor/
12
/node_modules
23
/public/hot
34
/public/storage

app/Console/Kernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Kernel extends ConsoleKernel
1616
protected function schedule(Schedule $schedule)
1717
{
1818
// $schedule->command('inspire')->hourly();
19+
$schedule->command('telescope:prune --hours=48')->daily();
1920
}
2021

2122
/**

app/Providers/AppServiceProvider.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ class AppServiceProvider extends ServiceProvider
1313
*/
1414
public function register()
1515
{
16-
//
16+
if ($this->app->environment('local')) {
17+
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
18+
$this->app->register(TelescopeServiceProvider::class);
19+
}
1720
}
1821

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

application.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Sail Commands
2+
3+
./vendor/bin/sail up
4+
./vendor/bin/sail composer require laravel/telescope
5+
./vendor/bin/sail php artisan telescope:install
6+
7+
# Laravel Telescope - Laravel
8+
9+
/telescope

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"guzzlehttp/guzzle": "^7.2",
1010
"laravel/framework": "^9.11",
1111
"laravel/sanctum": "^2.14.1",
12+
"laravel/telescope": "^4.9",
1213
"laravel/tinker": "^2.7"
1314
},
1415
"require-dev": {
@@ -48,7 +49,9 @@
4849
},
4950
"extra": {
5051
"laravel": {
51-
"dont-discover": []
52+
"dont-discover": [
53+
"laravel/telescope"
54+
]
5255
}
5356
},
5457
"config": {

composer.lock

Lines changed: 70 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/app.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@
194194
// App\Providers\BroadcastServiceProvider::class,
195195
App\Providers\EventServiceProvider::class,
196196
App\Providers\RouteServiceProvider::class,
197+
App\Providers\TelescopeServiceProvider::class,
197198

198199
],
199200

0 commit comments

Comments
 (0)