Wiggum
a php framework
By following the steps below your controllers will have access to a database connection and query builder via a object property $this->db
$app->addService('db', function() {
$config = $this->config->get('services.db');
return new wiggum\services\db\DB($config);
});Add the below code to the services.php file in your boot folder.
...
'db' => [
'username' => 'username',
'password' => 'password',
'name' => 'databaseName',
'url' => 'localhost',
'port' => '3306',
'protocol' => 'mysql'
],
...Add the below settings array to your services.php file found in your confirg folder. Update the varibles to your own database credentials.