public function __construct($config = null)
{
try {
$this->connection = self::prepareConnection($config);
} catch (Exception $e) {
// throw with message
throw new InvalidArgumentException("Could not connect to MySQL database. " . $e->getMessage(), $e->getCode());
}
$this->database = Arr::get($config, 'database', config('database.connections.mysql.database'));
$this->connection->query("SET names 'utf8'");
}