Laravel 和 MySQL .env 配置未应用

Laravel and MySQL .env configuration not being applied

我是 Laravel 的新手,但这不是我的第一个应用程序。我创建了一个博客作为我的第一个实践项目。我在创建博客时没有遇到这个问题。

我更新了 .env 文件以反映应用程序名称和数据库凭据。我使用 bash 创建控制器、模型并迁移数据库表。一切顺利。数据库反映了新表。

但是,我注意到页面和元标题不正确。它仍然显示旧的默认值“Laravel”。当我做 ui:auth 时,我试图测试注册页面并得到错误:

Illuminate\Database\QueryException SQLSTATE[HY000] [1049] Unknown database 'laravel' (SQL: select count(*) as aggregate from users where email = email@gmail.com) http://localhost:8000/register Hide solutions Database name seems incorrect You're using the default database name laravel. This database does not exist.

Edit the .env file and use the correct database name in the DB_DATABASE key.

我已经编辑了 .env 文件。当我在单独的编辑器中将其拉出时,它会显示我的更改,并且“laravel”在文件中无处可寻。这是怎么回事?我尝试清除浏览器历史记录以防缓存问题。我在文件结构中搜索了其他可能的配置文件,甚至更改了 .env.example 文件,但它仍然不显示我的更改。我完全不知道如何进行。我搜索了规格,看看是否能找到我遗漏的步骤,但我不知所措。

APP_NAME=MandalanTales
APP_ENV=local
APP_KEY=base64:HCZ7ZwocluPDKnz/r5nn5w51DNZRo0GI/8rRGUONRBI=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=mandalan
DB_USERNAME=AliciaGuitar
DB_PASSWORD=abc123

我从我的 .gitignore 中删除了我的 .env 文件,这样你就可以看到它了。请帮忙。我 self-taught 没有 in-person 资源。这是我的 git:MandalanTales Git

每次更改 .env 文件时,您需要 运行 在 cmd

php artisan config:cache

之后,运行程序php artisan serve