File tree 2 files changed +28
-7
lines changed
2 files changed +28
-7
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,13 @@ class Passport
161
161
*/
162
162
public static $ authorizationServerResponseType ;
163
163
164
+ /**
165
+ * Indicates if Passport routes will be registered.
166
+ *
167
+ * @var bool
168
+ */
169
+ public static $ registersRoutes = true ;
170
+
164
171
/**
165
172
* Enable the implicit grant type.
166
173
*
@@ -630,6 +637,18 @@ public static function tokenEncryptionKey(Encrypter $encrypter)
630
637
$ encrypter ->getKey ();
631
638
}
632
639
640
+ /**
641
+ * Configure Passport to not register its routes.
642
+ *
643
+ * @return static
644
+ */
645
+ public static function ignoreRoutes ()
646
+ {
647
+ static ::$ registersRoutes = false ;
648
+
649
+ return new static ;
650
+ }
651
+
633
652
/**
634
653
* Configure Passport to not register its migrations.
635
654
*
Original file line number Diff line number Diff line change @@ -50,13 +50,15 @@ public function boot()
50
50
*/
51
51
protected function registerRoutes ()
52
52
{
53
- Route::group ([
54
- 'as ' => 'passport. ' ,
55
- 'prefix ' => config ('passport.path ' , 'oauth ' ),
56
- 'namespace ' => 'Laravel\Passport\Http\Controllers ' ,
57
- ], function () {
58
- $ this ->loadRoutesFrom (__DIR__ .'/../routes/web.php ' );
59
- });
53
+ if (Passport::$ registersRoutes ) {
54
+ Route::group ([
55
+ 'as ' => 'passport. ' ,
56
+ 'prefix ' => config ('passport.path ' , 'oauth ' ),
57
+ 'namespace ' => 'Laravel\Passport\Http\Controllers ' ,
58
+ ], function () {
59
+ $ this ->loadRoutesFrom (__DIR__ .'/../routes/web.php ' );
60
+ });
61
+ }
60
62
}
61
63
62
64
/**
You can’t perform that action at this time.
0 commit comments