Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand All @@ -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"
},
Expand Down
3 changes: 2 additions & 1 deletion src/Eloquent/SpatialExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')";
}
Expand Down
2 changes: 1 addition & 1 deletion src/MysqlConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct($pdo, $database = '', $tablePrefix = '', array $conf
*/
protected function getDefaultSchemaGrammar()
{
return $this->withTablePrefix(new MySqlGrammar());
return new MySqlGrammar($this);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Schema/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
4 changes: 3 additions & 1 deletion src/Schema/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down