summaryrefslogtreecommitdiff
path: root/vendor/illuminate/database
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/illuminate/database')
-rw-r--r--vendor/illuminate/database/ConfigurationUrlParser.php186
-rwxr-xr-xvendor/illuminate/database/DatabaseManager.php1
-rwxr-xr-xvendor/illuminate/database/Eloquent/Builder.php6
-rwxr-xr-xvendor/illuminate/database/Query/Builder.php2
4 files changed, 10 insertions, 185 deletions
diff --git a/vendor/illuminate/database/ConfigurationUrlParser.php b/vendor/illuminate/database/ConfigurationUrlParser.php
index 2b2430c113..bc7c624a28 100644
--- a/vendor/illuminate/database/ConfigurationUrlParser.php
+++ b/vendor/illuminate/database/ConfigurationUrlParser.php
@@ -2,189 +2,9 @@
namespace Illuminate\Database;
-use Illuminate\Support\Arr;
-use InvalidArgumentException;
+use Illuminate\Support\ConfigurationUrlParser as BaseConfigurationUrlParser;
-class ConfigurationUrlParser
+class ConfigurationUrlParser extends BaseConfigurationUrlParser
{
- /**
- * The drivers aliases map.
- *
- * @var array
- */
- protected static $driverAliases = [
- 'mssql' => 'sqlsrv',
- 'mysql2' => 'mysql', // RDS
- 'postgres' => 'pgsql',
- 'postgresql' => 'pgsql',
- 'sqlite3' => 'sqlite',
- ];
-
- /**
- * Parse the database configuration, hydrating options using a database configuration URL if possible.
- *
- * @param array|string $config
- * @return array
- */
- public function parseConfiguration($config)
- {
- if (is_string($config)) {
- $config = ['url' => $config];
- }
-
- $url = $config['url'] ?? null;
-
- $config = Arr::except($config, 'url');
-
- if (! $url) {
- return $config;
- }
-
- $parsedUrl = $this->parseUrl($url);
-
- return array_merge(
- $config,
- $this->getPrimaryOptions($parsedUrl),
- $this->getQueryOptions($parsedUrl)
- );
- }
-
- /**
- * Get the primary database connection options.
- *
- * @param array $url
- * @return array
- */
- protected function getPrimaryOptions($url)
- {
- return array_filter([
- 'driver' => $this->getDriver($url),
- 'database' => $this->getDatabase($url),
- 'host' => $url['host'] ?? null,
- 'port' => $url['port'] ?? null,
- 'username' => $url['user'] ?? null,
- 'password' => $url['pass'] ?? null,
- ], function ($value) {
- return ! is_null($value);
- });
- }
-
- /**
- * Get the database driver from the URL.
- *
- * @param array $url
- * @return string|null
- */
- protected function getDriver($url)
- {
- $alias = $url['scheme'] ?? null;
-
- if (! $alias) {
- return;
- }
-
- return static::$driverAliases[$alias] ?? $alias;
- }
-
- /**
- * Get the database name from the URL.
- *
- * @param array $url
- * @return string|null
- */
- protected function getDatabase($url)
- {
- $path = $url['path'] ?? null;
-
- return $path ? substr($path, 1) : null;
- }
-
- /**
- * Get all of the additional database options from the query string.
- *
- * @param array $url
- * @return array
- */
- protected function getQueryOptions($url)
- {
- $queryString = $url['query'] ?? null;
-
- if (! $queryString) {
- return [];
- }
-
- $query = [];
-
- parse_str($queryString, $query);
-
- return $this->parseStringsToNativeTypes($query);
- }
-
- /**
- * Parse the string URL to an array of components.
- *
- * @param string $url
- * @return array
- */
- protected function parseUrl($url)
- {
- $url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url);
-
- $parsedUrl = parse_url($url);
-
- if ($parsedUrl === false) {
- throw new InvalidArgumentException('The database configuration URL is malformed.');
- }
-
- return $this->parseStringsToNativeTypes(
- array_map('rawurldecode', $parsedUrl)
- );
- }
-
- /**
- * Convert string casted values to their native types.
- *
- * @param mixed $value
- * @return mixed
- */
- protected function parseStringsToNativeTypes($value)
- {
- if (is_array($value)) {
- return array_map([$this, 'parseStringsToNativeTypes'], $value);
- }
-
- if (! is_string($value)) {
- return $value;
- }
-
- $parsedValue = json_decode($value, true);
-
- if (json_last_error() === JSON_ERROR_NONE) {
- return $parsedValue;
- }
-
- return $value;
- }
-
- /**
- * Get all of the current drivers aliases.
- *
- * @return array
- */
- public static function getDriverAliases()
- {
- return static::$driverAliases;
- }
-
- /**
- * Add the given driver alias to the driver aliases array.
- *
- * @param string $alias
- * @param string $driver
- * @return void
- */
- public static function addDriverAlias($alias, $driver)
- {
- static::$driverAliases[$alias] = $driver;
- }
+ //
}
diff --git a/vendor/illuminate/database/DatabaseManager.php b/vendor/illuminate/database/DatabaseManager.php
index 05d8cf0d45..a5993066eb 100755
--- a/vendor/illuminate/database/DatabaseManager.php
+++ b/vendor/illuminate/database/DatabaseManager.php
@@ -6,6 +6,7 @@ use PDO;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use InvalidArgumentException;
+use Illuminate\Support\ConfigurationUrlParser;
use Illuminate\Database\Connectors\ConnectionFactory;
/**
diff --git a/vendor/illuminate/database/Eloquent/Builder.php b/vendor/illuminate/database/Eloquent/Builder.php
index e827f4cc31..b4825a489a 100755
--- a/vendor/illuminate/database/Eloquent/Builder.php
+++ b/vendor/illuminate/database/Eloquent/Builder.php
@@ -870,7 +870,11 @@ class Builder
$values
);
- $values[$this->qualifyColumn($column)] = $values[$column];
+ $segments = preg_split('/\s+as\s+/i', $this->query->from);
+
+ $qualifiedColumn = end($segments).'.'.$column;
+
+ $values[$qualifiedColumn] = $values[$column];
unset($values[$column]);
diff --git a/vendor/illuminate/database/Query/Builder.php b/vendor/illuminate/database/Query/Builder.php
index 3311c1ad6e..670ea25d5f 100755
--- a/vendor/illuminate/database/Query/Builder.php
+++ b/vendor/illuminate/database/Query/Builder.php
@@ -2078,7 +2078,7 @@ class Builder
/**
* Execute a query for a single record by ID.
*
- * @param int $id
+ * @param int|string $id
* @param array $columns
* @return mixed|static
*/