lundi 19 décembre 2016

Database [] not configured - Laravel

I have searched a lot about it and tried every possible solution I could find or think of.

So I am changing database configuration to a new database as follows:

DB::disconnect('mysql');
config(['database.connections.mysql.database' => $new_db_name]);

If i try to get the database name like:

dd(config('database.connections.mysql.database'));

I get the right database name which I just set. But when i try to run migration on it:

\Artisan::call('migrate', ['--database' => $new_db_name ]);

I get the error : Database [$new_db_name] not configured

Any help is appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire