Redirect homepage to authenticated page Laravel 8 Jetstream Livewire

  authentication, jetstream, laravel, redirect

I have the home page in web.php the login page:

Route::get('/', function () {
 return view('auth.login');
});

And when the user logs in the authenticated page:

Route::middleware(['auth:sanctum', 'verified'])->get('/admin', function () {
 return view('admin.index');
})->name('panel');

The problem is that if I manually type in the url of the browser, the main page appears the login page when it should redirect to the authenticated page since the user does not have to re-enter the credentials.

In RouteServiceProvider.php:

public const HOME = '/admin';

Source: Laravel

Leave a Reply