Skip to content

Commit

Permalink
Merge pull request #13 from MarkIvanowich/ignore-routes
Browse files Browse the repository at this point in the history
Provide a way of customizing/disabling the default routes
  • Loading branch information
taylorotwell committed Sep 8, 2020
2 parents b3dd191 + e8d129b commit f29ed3f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
19 changes: 19 additions & 0 deletions src/Fortify.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@

class Fortify
{
/**
* Indicates if Fortify routes will be registered.
*
* @var bool
*/
public static $registersRoutes = true;

/**
* Get the username used for authentication.
*/
Expand Down Expand Up @@ -172,4 +179,16 @@ public static function resetUserPasswordsUsing(string $callback)
{
return app()->singleton(ResetsUserPasswords::class, $callback);
}

/**
* Configure Fortify to not register its routes.
*
* @return static
*/
public static function ignoreRoutes()
{
static::$registersRoutes = false;

return new static;
}
}
16 changes: 9 additions & 7 deletions src/FortifyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,14 @@ protected function configurePublishing()
*/
protected function configureRoutes()
{
Route::group([
'namespace' => 'Laravel\Fortify\Http\Controllers',
'domain' => config('fortify.domain', null),
'prefix' => config('fortify.path'),
], function () {
$this->loadRoutesFrom(__DIR__.'/../routes/routes.php');
});
if (Fortify::$registersRoutes) {
Route::group([
'namespace' => 'Laravel\Fortify\Http\Controllers',
'domain' => config('fortify.domain', null),
'prefix' => config('fortify.path'),
], function () {
$this->loadRoutesFrom(__DIR__.'/../routes/routes.php');
});
}
}
}

0 comments on commit f29ed3f

Please sign in to comment.