public function setCredentials($credentials)
    {
        if (function_exists('env')) {
            $host = env('DB_HOST');
            $dbname = env('DB_DATABASE');
            $username = env('DB_USERNAME');
            $password = env('DB_PASSWORD');
        } else {
            $host = $credentials['host'];
            $dbname = $credentials['dbname'];
            $username = $credentials['username'];
            $password = $credentials['password'];
        }

        $this->db = new PDO(
            "mysql:host={$host};dbname={$dbname};charset=utf8mb4",
            $username,
            $password
        );
    }
public function setCredentials($credentials)
    {
        if (function_exists('env')) {
            $host = env('DB_HOST');
            $dbname = env('DB_DATABASE');
            $username = env('DB_USERNAME');
            $password = env('DB_PASSWORD');
        } else {
            $host = $credentials['host'];
            $dbname = $credentials['dbname'];
            $username = $credentials['username'];
            $password = $credentials['password'];
        }

        $this->db = new PDO(
            "mysql:host={$host};dbname={$dbname};charset=utf8mb4",
            $username,
            $password
        );
    }
public function setCredentials ( $ credentials ) { if ( function_exists ( 'env' ) ) { $ host = env ( 'DB_HOST' ) ; $ dbname = env ( 'DB_DATABASE' ) ; $ username = env ( 'DB_USERNAME' ) ; $ password = env ( 'DB_PASSWORD' ) ; } else { $ host = $ credentials [ 'host' ] ; $ dbname = $ credentials [ 'dbname' ] ; $ username = $ credentials [ 'username' ] ; $ password = $ credentials [ 'password' ] ; } $ this -> db = new PDO ( "mysql:host={$host};dbname={$dbname};charset=utf8mb4" , $ username , $ password ) ; }
Set the credentials to connect with mysql
@param array $credentials
Set the credentials to connect with mysql