vendredi 3 août 2018

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'products.all_category' doesn't exist (SQL: select * from `all_countries`)

 'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],
    'mysql2' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST_2', '127.0.0.1'),
        'port' => env('DB_PORT_2', '3306'),
        'database' => env('DB_DATABASE_2', 'forge'),
        'username' => env('DB_USERNAME_2', 'forge'),
        'password' => env('DB_PASSWORD_2', ''),
        'unix_socket' => env('DB_SOCKET', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],

products is the default database and all_category is the table name in second database called category it is not even identifying the second database category ,it is only taking the first default one while configuring ,here is the query inside controller:-

$users = DB::connection('mysql2')->table("all_category")->get(); 

Any help would be much appreciate, Thanks in advance



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire