File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -471,15 +471,15 @@ Place::create(['polygon' => $polygon]);
471
471
472
472
$placeWithCentroid = Place::query()
473
473
->withCentroid('polygon')
474
- ->withCast( 'centroid', Point:class) // This is important, otherwise the centroid will be returned as a binary string.
474
+ ->withCasts([ 'centroid' => Point:: class] ) // This is important, otherwise the centroid will be returned as a binary string.
475
475
->first();
476
476
477
477
echo $placeWithDistance->centroid; // POINT(0 0)
478
478
479
479
// when using alias:
480
480
$placeWithCentroid = Place::query()
481
481
->withCentroid('polygon', 'centroid_alias')
482
- ->withCast( 'centroid_alias', Point:class)
482
+ ->withCasts([ 'centroid_alias' => Point:: class] )
483
483
->first();
484
484
485
485
echo $placeWithDistance->centroid_alias; // POINT(0 0)
You can’t perform that action at this time.
0 commit comments