Refactor Polyline resolveAttribute.

This commit is contained in:
Lasse S. Haslev
2021-01-26 15:18:54 +01:00
parent 97065c0377
commit 024010b867

View File

@@ -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);
} }
} }