Skip to content

Commit 289696a

Browse files
committed
- add laravel telescope
- upgrade laravel to 5.7.19
1 parent 826770f commit 289696a

File tree

6 files changed

+1025
-187
lines changed

6 files changed

+1025
-187
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
APP_ENV=local
2+
APP_DEBUG=true
3+
DEBUGBAR=true
4+
TELESCOPE_ENABLED=true
15
APP_NAME="Laravel Admin Panel"
26
APP_SHORT_NAME="LAP"
37
APP_ENV=local
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
3+
namespace App\Providers;
4+
5+
use Laravel\Telescope\Telescope;
6+
use Illuminate\Support\Facades\Gate;
7+
use Laravel\Telescope\IncomingEntry;
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->isLocal()) {
25+
return true;
26+
}
27+
28+
return $entry->isReportableException() ||
29+
$entry->isFailedJob() ||
30+
$entry->isScheduledTask() ||
31+
$entry->hasMonitoredTag();
32+
});
33+
}
34+
35+
/**
36+
* Prevent sensitive request details from being logged by Telescope.
37+
*
38+
* @return void
39+
*/
40+
protected function hideSensitiveRequestDetails()
41+
{
42+
if ($this->app->isLocal()) {
43+
return;
44+
}
45+
46+
Telescope::hideRequestParameters(['_token']);
47+
48+
Telescope::hideRequestHeaders([
49+
'cookie',
50+
'x-csrf-token',
51+
'x-xsrf-token',
52+
]);
53+
}
54+
55+
/**
56+
* Register the Telescope gate.
57+
*
58+
* This gate determines who can access Telescope in non-local environments.
59+
*
60+
* @return void
61+
*/
62+
protected function gate()
63+
{
64+
Gate::define('viewTelescope', function ($user) {
65+
return in_array($user->email, [
66+
//
67+
]);
68+
});
69+
}
70+
}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
"laravel/tinker": "~1.0",
2525
"laravelcollective/html": "^5.4.0",
2626
"spatie/laravel-cors": "^1.2",
27-
"tymon/jwt-auth":"1.0.0-rc.3",
27+
"tymon/jwt-auth": "1.0.0-rc.3",
2828
"unisharp/laravel-filemanager": "~1.8",
2929
"yajra/laravel-datatables-oracle": "~8.0"
3030
},
3131
"require-dev": {
32+
"laravel/telescope": "^1.0",
3233
"barryvdh/laravel-debugbar": "^3.0",
3334
"bvipul/generator": "^5.6",
3435
"codedungeon/phpunit-result-printer": "^0.19.10",

0 commit comments

Comments
 (0)