App\services\Database::__construct PHP Method

__construct() public method

Construct with a config array.
public __construct ( array $config = null )
$config array
    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'");
    }