mirror of
https://github.com/KevinMidboe/nova-map-fields.git
synced 2025-10-29 17:50:27 +00:00
Refactor Polyline resolveAttribute.
This commit is contained in:
@@ -29,11 +29,12 @@ class Polyline extends MapField
|
|||||||
*/
|
*/
|
||||||
public function resolveAttribute($resource, $attribute = null)
|
public function resolveAttribute($resource, $attribute = null)
|
||||||
{
|
{
|
||||||
return json_decode($resource->{$attribute});
|
$value = $resource->{$attribute};
|
||||||
|
|
||||||
return [
|
if (is_array($value)) {
|
||||||
'lat' => $resource->{$this->meta['latitudeField']},
|
return $value;
|
||||||
'lng' => $resource->{$this->meta['longitudeField']},
|
}
|
||||||
];
|
|
||||||
|
return json_decode($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user