Skip to content

Commit e2ce63d

Browse files
driesvintstaylorotwell
andauthoredJul 18, 2021
[5.x] Refactor routes (#1095)
* Refactor routes * formatting Co-authored-by: Taylor Otwell <[email protected]>
1 parent c658e6a commit e2ce63d

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed
 

‎src/Http/routes.php ‎routes/web.php

File renamed without changes.

‎src/TelescopeServiceProvider.php

+15-18
Original file line numberDiff line numberDiff line change
@@ -27,50 +27,47 @@ public function boot()
2727
Route::middlewareGroup('telescope', config('telescope.middleware', []));
2828

2929
$this->registerRoutes();
30+
$this->registerResources();
3031
$this->registerMigrations();
3132
$this->registerPublishing();
3233

3334
Telescope::start($this->app);
3435
Telescope::listenForStorageOpportunities($this->app);
35-
36-
$this->loadViewsFrom(
37-
__DIR__.'/../resources/views', 'telescope'
38-
);
3936
}
4037

4138
/**
4239
* Register the package routes.
4340
*
4441
* @return void
4542
*/
46-
private function registerRoutes()
43+
protected function registerRoutes()
4744
{
48-
Route::group($this->routeConfiguration(), function () {
49-
$this->loadRoutesFrom(__DIR__.'/Http/routes.php');
45+
Route::group([
46+
'domain' => config('telescope.domain', null),
47+
'namespace' => 'Laravel\Telescope\Http\Controllers',
48+
'prefix' => config('telescope.path'),
49+
'middleware' => 'telescope',
50+
], function () {
51+
$this->loadRoutesFrom(__DIR__.'/../routes/web.php');
5052
});
5153
}
5254

5355
/**
54-
* Get the Telescope route group configuration array.
56+
* Register the Telescope resources.
5557
*
56-
* @return array
58+
* @return void
5759
*/
58-
private function routeConfiguration()
60+
protected function registerResources()
5961
{
60-
return [
61-
'domain' => config('telescope.domain', null),
62-
'namespace' => 'Laravel\Telescope\Http\Controllers',
63-
'prefix' => config('telescope.path'),
64-
'middleware' => 'telescope',
65-
];
62+
$this->loadViewsFrom(__DIR__.'/../resources/views', 'telescope');
6663
}
6764

6865
/**
6966
* Register the package's migrations.
7067
*
7168
* @return void
7269
*/
73-
private function registerMigrations()
70+
protected function registerMigrations()
7471
{
7572
if ($this->app->runningInConsole() && $this->shouldMigrate()) {
7673
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
@@ -82,7 +79,7 @@ private function registerMigrations()
8279
*
8380
* @return void
8481
*/
85-
private function registerPublishing()
82+
protected function registerPublishing()
8683
{
8784
if ($this->app->runningInConsole()) {
8885
$this->publishes([

0 commit comments

Comments
 (0)
Please sign in to comment.