itskp-odense/vendor/illuminate/database/PDO/Concerns/ConnectsToDatabase.php

28 lines
661 B
PHP
Raw Normal View History

2021-06-01 08:17:03 +00:00
<?php
namespace Illuminate\Database\PDO\Concerns;
use Illuminate\Database\PDO\Connection;
use InvalidArgumentException;
use PDO;
trait ConnectsToDatabase
{
/**
* Create a new database connection.
*
* @param array $params
* @return \Illuminate\Database\PDO\Connection
*
* @throws \InvalidArgumentException
*/
public function connect(array $params)
{
if (! isset($params['pdo']) || ! $params['pdo'] instanceof PDO) {
throw new InvalidArgumentException('Laravel requires the "pdo" property to be set and be a PDO instance.');
}
return new Connection($params['pdo']);
}
}