diff --git a/composer.json b/composer.json index 4451cb50..364b6238 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "test:unit": "phpunit -c phpunit.xml.dist --testsuite unit", "test:integration": "phpunit -c phpunit.xml.dist --testsuite integration" }, - "type": "library", + "type": "wordpress-theme", "license": "MIT", "authors": [ { @@ -18,7 +18,6 @@ "php": ">=7.3", "ext-pdo": "*", "ext-json": "*", - "illuminate/database": "^8.0", "geo-io/wkb-parser": "^1.0", "jmikola/geojson": "^1.0" }, diff --git a/src/Eloquent/SpatialExpression.php b/src/Eloquent/SpatialExpression.php index 9224af0f..b3690807 100644 --- a/src/Eloquent/SpatialExpression.php +++ b/src/Eloquent/SpatialExpression.php @@ -3,10 +3,11 @@ namespace Grimzy\LaravelMysqlSpatial\Eloquent; use Illuminate\Database\Query\Expression; +use Illuminate\Database\Grammar; class SpatialExpression extends Expression { - public function getValue() + public function getValue(Grammar $grammar) { return "ST_GeomFromText(?, ?, 'axis-order=long-lat')"; } diff --git a/src/MysqlConnection.php b/src/MysqlConnection.php index 38a2b1a4..1b7b4d08 100644 --- a/src/MysqlConnection.php +++ b/src/MysqlConnection.php @@ -40,7 +40,7 @@ public function __construct($pdo, $database = '', $tablePrefix = '', array $conf */ protected function getDefaultSchemaGrammar() { - return $this->withTablePrefix(new MySqlGrammar()); + return new MySqlGrammar($this); } /** diff --git a/src/Schema/Blueprint.php b/src/Schema/Blueprint.php index 0a333f06..2f4d1a84 100644 --- a/src/Schema/Blueprint.php +++ b/src/Schema/Blueprint.php @@ -14,7 +14,7 @@ class Blueprint extends IlluminateBlueprint * * @return \Illuminate\Support\Fluent */ - public function geometry($column, $srid = null) + public function geometry($column, $subtype = null, $srid = 0) { return $this->addColumn('geometry', $column, compact('srid')); } diff --git a/src/Schema/Builder.php b/src/Schema/Builder.php index baf8dc58..993f32ef 100644 --- a/src/Schema/Builder.php +++ b/src/Schema/Builder.php @@ -17,6 +17,6 @@ class Builder extends MySqlBuilder */ protected function createBlueprint($table, Closure $callback = null) { - return new Blueprint($table, $callback); + return new Blueprint($this->connection, $table, $callback); } } diff --git a/src/Schema/Grammars/MySqlGrammar.php b/src/Schema/Grammars/MySqlGrammar.php index 9afe4513..e1a2c4bb 100644 --- a/src/Schema/Grammars/MySqlGrammar.php +++ b/src/Schema/Grammars/MySqlGrammar.php @@ -10,8 +10,10 @@ class MySqlGrammar extends IlluminateMySqlGrammar { const COLUMN_MODIFIER_SRID = 'Srid'; - public function __construct() + public function __construct(\Illuminate\Database\Connection $connection) { + parent::__construct($connection); + // Enable SRID as a column modifier if (!in_array(self::COLUMN_MODIFIER_SRID, $this->modifiers)) { $this->modifiers[] = self::COLUMN_MODIFIER_SRID;