I have the application properly configured and running normally. But one detail is stuck.
This is my .env file:
APP_ENV=local
APP_DEBUG=true
APP_KEY=9FaEj6iJCBur1favtWQ88b8m1anbGbzP
DB_HOST=localhost
DB_DATABASE=laravel_blog
DB_USERNAME=root
DB_PASSWORD=
...
When I run the command env('DB_DATABASE','forge')
in tinker, the value laravel_blog
is returned, as it should be.
However when I do exactly the same operation inside a controller, the value homestead
is returned, it should not return this
Following is the connection to the bank:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
It finishes creating the situation that the bank runs in the tinker, but in the controller it does not work, because it takes the wrong connection data.
The problem is that I have no idea where laravel is pulling the value of the constant inside the controller, since in .env the configured value is different.