connection = new PDO($dsn, $username, $password, [PDO::ATTR_DEFAULT_FETCH_MODE=> PDO::FETCH_ASSOC]); } public function query($query, $params = []) { $this->statement = $this->connection->prepare($query); $this->statement->execute($params); return $this; } public function find() { return $this->statement->fetch(); } public function findOrFail() { $result = $this->find(); if (! $result) { abort(); } return $result; } public function get() { return $this->statement->fetchAll(); } }