mirror of
https://github.com/KevinMidboe/nova-map-fields.git
synced 2025-10-29 09:40: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)
|
||||
{
|
||||
return json_decode($resource->{$attribute});
|
||||
$value = $resource->{$attribute};
|
||||
|
||||
return [
|
||||
'lat' => $resource->{$this->meta['latitudeField']},
|
||||
'lng' => $resource->{$this->meta['longitudeField']},
|
||||
];
|
||||
if (is_array($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return json_decode($value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user