Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace App\Models;
- abstract class Models
- {
- protected $connection;
- protected $host = 'localhost';
- protected $db = 'db';
- protected $user = 'user';
- protected $password = 'password';
- protected $charset = 'utf-8';
- protected $type = 'mysql';
- function __construct()
- {
- $this->connection = new \PDO(
- $this->type.":host=".$this->host.";dbname=".$this->db.";charset=".$this->charset,
- $this->user,
- $this->password,
- [
- \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
- \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC
- ]
- );
- }
- public function getConnection(){
- return $this->connection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement