Routes file redirect

Published 4 months ago by jrock2004

I am trying to figure out in the routes file how I can redirect based based off an if statement

// Auth Routes
Auth::routes();

if (!env('ALLOW_REGISTRATION', false)) {
    Route::any('/register', function() {
        redirect('/home/index');
    });
}

// Home Controller
Route::get('/', [email protected]');

Right now what happens is I get a blank page. Maybe I should just 404 since I am trying to hide that route?

jrock2004

Mods, please delete. I forgot to add return in front of redirect

Sign In or create a forum account to participate in this discussion.