Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Models;
- class Db
- {
- protected $dbh;
- public function __construct()
- {
- $config = (include __DIR__ . '/../../config.php')['db'];
- $this->dbh = new \PDO('mysql:host=' . $config['host'] . ';dbname=' . $config['dbname'], $config['user'], $config['password']);
- }
- public function query($class)
- {
- return $this->dbh->query()->fetchAll(\PDO::FETCH_CLASS, $class);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement