Skip to content

Commit b0215c2

Browse files
committed
Add name_prefix configuration option to Fortify
1 parent 8c539e1 commit b0215c2

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

config/fortify.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
'views' => true,
1313
'home' => '/home',
1414
'prefix' => '',
15+
'name_prefix' => '',
1516
'domain' => null,
1617
'lowercase_usernames' => false,
1718
'limiters' => [

src/FortifyServiceProvider.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\Facades\Auth;
88
use Illuminate\Support\Facades\Route;
99
use Illuminate\Support\ServiceProvider;
10+
use Illuminate\Support\Str;
1011
use Laravel\Fortify\Actions\RedirectIfTwoFactorAuthenticatable;
1112
use Laravel\Fortify\Contracts\EmailVerificationNotificationSentResponse as EmailVerificationNotificationSentResponseContract;
1213
use Laravel\Fortify\Contracts\FailedPasswordConfirmationResponse as FailedPasswordConfirmationResponseContract;
@@ -158,11 +159,15 @@ protected function configurePublishing()
158159
*/
159160
protected function configureRoutes()
160161
{
162+
$as = config('fortify.name_prefix', '');
163+
$as = $as !== '' ? Str::finish($as, '.') : '';
164+
161165
if (Fortify::$registersRoutes) {
162166
Route::group([
163167
'namespace' => 'Laravel\Fortify\Http\Controllers',
164168
'domain' => config('fortify.domain', null),
165169
'prefix' => config('fortify.prefix'),
170+
'as' => $as,
166171
], function () {
167172
$this->loadRoutesFrom(__DIR__.'/../routes/routes.php');
168173
});

stubs/fortify.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,15 @@
8181
|--------------------------------------------------------------------------
8282
|
8383
| Here you may specify which prefix Fortify will assign to all the routes
84-
| that it registers with the application. If necessary, you may change
85-
| subdomain under which all of the Fortify routes will be available.
84+
| that it registers in the application. You may also give a route name
85+
| prefix and the subdomain under which all the Fortify routes exist.
8686
|
8787
*/
8888

8989
'prefix' => '',
9090

91+
'name_prefix' => '',
92+
9193
'domain' => null,
9294

9395
/*

0 commit comments

Comments
 (0)