0
I have the application properly configured and running normally. But one detail is jamming.
This is my file . env:
APP_ENV=local
APP_DEBUG=true
APP_KEY=9FaEj6iJCBur1favtWQ88b8m1anbGbzP
DB_HOST=localhost
DB_DATABASE=laravel_blog
DB_USERNAME=root
DB_PASSWORD=
...
When I execute the command env('DB_DATABASE','forge')
in Tinker, the value is returned laravel_blog
, as it should be.
However when I do exactly the same operation inside a controller, the value is returned homestead
, shouldn’t return that
Following as is the connection with 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 ends up creating the situation that the database runs on Tinker, but the controller doesn’t work, because it takes the data from the wrong connection.
The problem is that I have no idea where the Variable is pulling the value of the constant inside the controller, since no . env the configured value is different.
I could post your code for a better analysis.
– durtto
ok updated....
– Adriano Luz
which version of the Laravel used?
– Raylan Soares
I’m using the 5
– Adriano Luz
You’re using the Homestead?
– gmsantos