map(function ($value) { return new Endpoint($value); }); } public function set($model, $key, $value, $attributes) { if (!is_array($value) && !$value instanceof Collection) { return new Collection(); } if (!$value instanceof Collection) { $value = new Collection($value); } return [ 'ports' => $value->toJson(), ]; } }; } }