Skip to content

Commit

Permalink
Load telescope conditionally, in local/testing env
Browse files Browse the repository at this point in the history
  • Loading branch information
specialtactics committed Jul 31, 2019
1 parent c3f1b2d commit 2d303b3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
11 changes: 11 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function boot()
public function register()
{
$this->registerExceptionHandler();
$this->registerTelescope();
}

/**
Expand All @@ -39,4 +40,14 @@ protected function registerExceptionHandler()
return new ApiExceptionHandler($app['Illuminate\Contracts\Debug\ExceptionHandler'], Config('api.errorFormat'), Config('api.debug'));
});
}

/**
* Conditionally register the telescope service provider
*/
protected function registerTelescope()
{
if ($this->app->environment('local', 'testing')) {
$this->app->register(TelescopeServiceProvider::class);
}
}
}
5 changes: 1 addition & 4 deletions app/Providers/TelescopeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ public function register()
return true;
}

return $entry->isReportableException() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
$entry->hasMonitoredTag();
return false;
});
}

Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
},
"extra": {
"laravel": {
"dont-discover": []
"dont-discover": [
"laravel/telescope"
]
}
},
"autoload": {
Expand Down
1 change: 0 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\TelescopeServiceProvider::class,
App\Providers\RouteServiceProvider::class,

],
Expand Down

0 comments on commit 2d303b3

Please sign in to comment.