php - Unable to choose specific database connection in Laravel -
i have defined second sqlite
connection in database.php
:
'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'database' => env('db_database', database_path('database.sqlite')), 'prefix' => '', ], 'hamilton' => [ 'driver' => 'sqlite', 'database' => env('db_database', database_path('hamilton.sqlite')), 'prefix' => '', ],
unfortunately, when try use this:
public function beyondmapservice($datasetname) { switch ($datasetname) { case 'population': $conn = db::conection('hamilton'); return $conn->select('select * stats;');
i exception on db::connection
line, saying
call_user_func_array() expects parameter 1 valid callback, class 'illuminate\database\sqliteconnection' not have method 'conection'
why , how use multiple databases?
update
my shame!
you spelt connection
wrong, spelt conection
Comments
Post a Comment