vendredi 1 septembre 2017

Error: [InvalidArgumentException] Database [fooBar] not configured Laravel 5.4

I'm trying to write a migration for a new table.

public function up()
    {
        Schema::connection('fooBar')->create('tableOfThings', function (Blueprint $table) {
            $table->increments('id');
            $table->timestamps();
        });
    }

But when I run php artisan migration, I get the following error.

[InvalidArgumentException]
Database [fooBar] not configured.

This is what I have in config/database.php. You can see that I do infact have this DB configured.

'connections' => [
    'foo_bar' => [
        'driver'    => 'mysql',
        'host'      => env('DB_HOST', 'localhost'),
        'port'      => env('DB_PORT', 3306),
        'database'  => 'fooBar',
        'username'  => env('DB_USERNAME', 'forge'),
        'password'  => env('DB_PASSWORD', ''),
        'charset'   => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix'    => '',
        'strict'    => true,
        'engine'    => null,
    ],
    // ...
]



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire