Skip to content

Commit

Permalink
升级版本到7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WangNingkai committed Jun 25, 2020
1 parent 1b742f4 commit 5d10fed
Show file tree
Hide file tree
Showing 14 changed files with 1,661 additions and 694 deletions.
10 changes: 5 additions & 5 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Exceptions;

use Exception;
use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
Expand All @@ -29,12 +29,12 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
parent::report($exception);
}
Expand All @@ -43,12 +43,12 @@ public function report(Exception $exception)
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Throwable $exception
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Exception
*/
public function render($request, Exception $exception)
public function render($request, Throwable $exception)
{
return parent::render($request, $exception);
}
Expand Down
3 changes: 3 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{
if ($this->app->isLocal()) {
$this->app->register(TelescopeServiceProvider::class);
}
}

/**
Expand Down
71 changes: 71 additions & 0 deletions app/Providers/TelescopeServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?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.
*
* @return void
*/
public function register()
{
// 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.
*
* @return void
*/
protected function hideSensitiveRequestDetails()
{
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.
*
* @return void
*/
protected function gate()
{
Gate::define('viewTelescope', function ($user) {
return in_array($user->email, [
//
]);
});
}
}
16 changes: 9 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^7.2",
"php": "^7.2.5",
"ext-bcmath": "*",
"ext-curl": "*",
"ext-fileinfo": "*",
Expand All @@ -26,11 +26,12 @@
"ext-openssl": "*",
"doctrine/dbal": "^2.10",
"erusev/parsedown": "^1.7",
"fideloper/proxy": "^4.0",
"fideloper/proxy": "^4.2",
"hashids/hashids": "^4.0",
"laravel/framework": "^6.2",
"laravel/framework": "^7.0",
"laravel/helpers": "^1.1",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.0",
"league/oauth2-client": "^2.4",
"microsoft/microsoft-graph": "^1.13",
"nette/finder": "^2.5",
Expand All @@ -40,13 +41,14 @@
"spatie/laravel-short-schedule": "^1.1"
},
"require-dev": {
"laravel/telescope": "^3.5",
"barryvdh/laravel-debugbar": "^3.3",
"barryvdh/laravel-ide-helper": "^2.6",
"facade/ignition": "^1.4",
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^3.0",
"phpunit/phpunit": "^8.0"
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.0",
"phpunit/phpunit": "^8.5"
},
"config": {
"optimize-autoloader": true,
Expand Down
Loading

0 comments on commit 5d10fed

Please sign in to comment.