How do you add a route to Fortify in Laravel 8?

You should never touch or mess with vendor as it is immaculate.

By default the fortify routes located on /vendor/laravel/fortify/routes/routes.php, but you shouldn’t edit anything inside the vendor folder otherwise whenever you run composer update it will overwrite any of your changes when the files update.

You can simply do the same on /routes/web.php with fortify middleware :

Route::group(['middleware' => config('fortify.middleware', ['web'])], function () {

    // with fortify guest middleware
    Route::get('foo', function () {
       return 'Foo';
    })->middleware(['guest']);

    // with fortify auth middleware
    Route::get('bar', function () {
       return 'bar';
    }) ->middleware(['auth']); // fortify auth middleware

});

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top