I'm having a weird issue with Laravel where it is looking for the connection mysql when there is no connection called mysql. In my database.php config, I have the default connection set to:
'default' => env('DB_CONNECTION', 'permissions'),
and in my .env file, I have the line:
DB_CONNECTION=permissions
Here is the stack trace:
local.ERROR: InvalidArgumentException: Database [mysql] not configured. in D:\Development\Permissions\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:239
Stack trace:
#0 D:\Development\Permissions\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(158): Illuminate\Database\DatabaseManager->getConfig('mysql')
#1 D:\Development\Permissions\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(68): Illuminate\Database\DatabaseManager->makeConnection('mysql')
#2 D:\Development\Permissions\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(3348): Illuminate\Database\DatabaseManager->connection('mysql')
#3 D:\Development\Permissions\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(3314): Illuminate\Database\Eloquent\Model::resolveConnection(NULL)
I traced the issue to a call to vendor\laravel\framework\src\Illuminate\Database\DatabaseManager->getDefaultConnection(). For some reason even though the default connection is set to permissions, the connection name that returns is mysql. Here is the function for reference:
public function getDefaultConnection()
{
return $this->app['config']['database.default'];
}
This issue is apearing on a Windows 10 box running ampps, but not an issue when running through homestead.
EDIT:
I can confirm that it is the 'default' => env('DB_CONNECTION', 'permissions'), line in the database.php file because when it is changed to be 'default' => 'permissions', the application works as expected.
php artisan config:clear)DatabaseManagerclass retrieving the incorrect default connection name.