*/ public function toArray(Request $request): array { $assetIds = []; foreach ($this->assets as $asset){ $assetIds[] = $asset['id']; } $plansIds = []; foreach ($this->plans as $plan){ $plansIds[] = $plan['id']; } return [ 'id' => $this->id, 'name' => $this->name, 'code' => $this->code, 'status' => $this->status, 'const' => $this->const, 'begin' => $this->begin, 'end' => $this->end, 'available_days' => $this->available_days, 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'type' => $this->type, 'acl' => $this->acl, 'assets' =>$assetIds, 'plans' =>$plansIds, //'whitelist' => $this->whitelist, 'description' => $this->description, ]; } }