Skip to content

Commit 3f545d7

Browse files
committed
fix api withCasts
1 parent 30e0a85 commit 3f545d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

API.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,15 +471,15 @@ Place::create(['polygon' => $polygon]);
471471

472472
$placeWithCentroid = Place::query()
473473
->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.
475475
->first();
476476

477477
echo $placeWithDistance->centroid; // POINT(0 0)
478478

479479
// when using alias:
480480
$placeWithCentroid = Place::query()
481481
->withCentroid('polygon', 'centroid_alias')
482-
->withCast('centroid_alias', Point:class)
482+
->withCasts(['centroid_alias' => Point::class])
483483
->first();
484484

485485
echo $placeWithDistance->centroid_alias; // POINT(0 0)

0 commit comments

Comments
 (0)