*/ public function toArray(Request $request): array { return [ 'id' => $this->id, 'name' => $this->name, 'user_ids' => $this->whenLoaded('users', fn (): array => $this->users->modelKeys()), 'users' => $this->whenLoaded('users', fn (): array => UserResource::collection($this->users)->resolve()), 'created_at' => $this->created_at?->toISOString(), 'updated_at' => $this->updated_at?->toISOString(), ]; } }