I am trying to add a new blade before the login screen. The welcome.blade.
So I
- created the welcome.blade.php under views
- added the route in web.php :
Route::get('/', function () {
return view('welcome');
})->name('welcome');
- Updated the Authenticate.php middleware in order to redirect not logged in users to welcome:
protected function redirectTo($request)
{
if (! $request->expectsJson()) {
return route('welcome');
}
}
But when I visit the url I get local.ERROR: Route [welcome] not defined
Also welcome is not in the list returned by php artisan route:list
I have trying clearing all cache but I still get this error.
2
Answers
Clear cache and try again!
If still show error run
composer dump-autoload
.php artisan optimize
Or
php artisan route:clear