skip to Main Content

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


  1. Clear cache and try again!
    If still show error run composer dump-autoload.

    Login or Signup to reply.
  2. php artisan optimize

    Or
    php artisan route:clear

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search