Skip to content

Commit f29ed3f

Browse files
authored
Merge pull request #13 from MarkIvanowich/ignore-routes
Provide a way of customizing/disabling the default routes
2 parents b3dd191 + e8d129b commit f29ed3f

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

src/Fortify.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616

1717
class Fortify
1818
{
19+
/**
20+
* Indicates if Fortify routes will be registered.
21+
*
22+
* @var bool
23+
*/
24+
public static $registersRoutes = true;
25+
1926
/**
2027
* Get the username used for authentication.
2128
*/
@@ -172,4 +179,16 @@ public static function resetUserPasswordsUsing(string $callback)
172179
{
173180
return app()->singleton(ResetsUserPasswords::class, $callback);
174181
}
182+
183+
/**
184+
* Configure Fortify to not register its routes.
185+
*
186+
* @return static
187+
*/
188+
public static function ignoreRoutes()
189+
{
190+
static::$registersRoutes = false;
191+
192+
return new static;
193+
}
175194
}

src/FortifyServiceProvider.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ protected function configurePublishing()
109109
*/
110110
protected function configureRoutes()
111111
{
112-
Route::group([
113-
'namespace' => 'Laravel\Fortify\Http\Controllers',
114-
'domain' => config('fortify.domain', null),
115-
'prefix' => config('fortify.path'),
116-
], function () {
117-
$this->loadRoutesFrom(__DIR__.'/../routes/routes.php');
118-
});
112+
if (Fortify::$registersRoutes) {
113+
Route::group([
114+
'namespace' => 'Laravel\Fortify\Http\Controllers',
115+
'domain' => config('fortify.domain', null),
116+
'prefix' => config('fortify.path'),
117+
], function () {
118+
$this->loadRoutesFrom(__DIR__.'/../routes/routes.php');
119+
});
120+
}
119121
}
120122
}

0 commit comments

Comments
 (0)