File tree Expand file tree Collapse file tree 2 files changed +34
-9
lines changed Expand file tree Collapse file tree 2 files changed +34
-9
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,11 @@ class Pulse
82
82
*/
83
83
protected bool $ runsMigrations = true ;
84
84
85
+ /**
86
+ * Indicates if Pulse routes will be registered.
87
+ */
88
+ protected bool $ registersRoutes = true ;
89
+
85
90
/**
86
91
* Handle exceptions using the given callback.
87
92
*
@@ -469,6 +474,24 @@ public function ignoreMigrations(): self
469
474
return $ this ;
470
475
}
471
476
477
+ /**
478
+ * Determine if Pulse may register routes.
479
+ */
480
+ public function registersRoutes (): bool
481
+ {
482
+ return $ this ->registersRoutes ;
483
+ }
484
+
485
+ /**
486
+ * Configure Pulse to not register its routes.
487
+ */
488
+ public function ignoreRoutes (): self
489
+ {
490
+ $ this ->registersRoutes = false ;
491
+
492
+ return $ this ;
493
+ }
494
+
472
495
/**
473
496
* Handle exceptions using the given callback.
474
497
*
Original file line number Diff line number Diff line change @@ -96,15 +96,17 @@ protected function registerAuthorization(): void
96
96
protected function registerRoutes (): void
97
97
{
98
98
$ this ->callAfterResolving ('router ' , function (Router $ router , Application $ app ) {
99
- $ router ->group ([
100
- 'domain ' => $ app ->make ('config ' )->get ('pulse.domain ' , null ),
101
- 'prefix ' => $ app ->make ('config ' )->get ('pulse.path ' ),
102
- 'middleware ' => $ app ->make ('config ' )->get ('pulse.middleware ' , 'web ' ),
103
- ], function (Router $ router ) {
104
- $ router ->get ('/ ' , function (Pulse $ pulse , ViewFactory $ view ) {
105
- return $ view ->make ('pulse::dashboard ' );
106
- })->name ('pulse ' );
107
- });
99
+ if ($ app ->make (Pulse::class)->registersRoutes ()) {
100
+ $ router ->group ([
101
+ 'domain ' => $ app ->make ('config ' )->get ('pulse.domain ' , null ),
102
+ 'prefix ' => $ app ->make ('config ' )->get ('pulse.path ' ),
103
+ 'middleware ' => $ app ->make ('config ' )->get ('pulse.middleware ' , 'web ' ),
104
+ ], function (Router $ router ) {
105
+ $ router ->get ('/ ' , function (Pulse $ pulse , ViewFactory $ view ) {
106
+ return $ view ->make ('pulse::dashboard ' );
107
+ })->name ('pulse ' );
108
+ });
109
+ }
108
110
});
109
111
}
110
112
You can’t perform that action at this time.
0 commit comments