*/ public function toArray(Request $request): array { $assetIds = []; $assets = []; foreach ($this->assets as $asset){ $assets[] = new AssetResource($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_detail' =>$assets, 'assets' =>$assetIds, 'plans' =>$plansIds, //'whitelist' => $this->whitelist, 'description' => $this->description, ]; } }