Skip to content

Commit 369d1a0

Browse files
author
Matan Yadaev
committed
Support column with table name in second parameter
1 parent 77295a7 commit 369d1a0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/SpatialBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,6 @@ protected function toExpression(Geometry|string $geometryOrColumn): Expression
302302
return DB::raw("ST_GeomFromText('{$wkt}', {$geometryOrColumn->srid}, 'axis-order=long-lat')");
303303
}
304304

305-
return DB::raw("`{$geometryOrColumn}`");
305+
return DB::raw($this->getQuery()->getGrammar()->wrap($geometryOrColumn));
306306
}
307307
}

tests/SpatialBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@
398398

399399
/** @var TestPlace $testPlaceWithDistance */
400400
$testPlaceWithDistance = TestPlace::query()
401-
->withDistance('test_places.point', new Point(0, 0, 4326))
401+
->withDistance('test_places.point', 'test_places.point')
402402
->firstOrFail();
403403

404404
expect($testPlaceWithDistance->distance)->toBe(0.0);

0 commit comments

Comments
 (0)