$this->when($this->isConsole, fn (): int => $this->id), 'token' => $this->token, 'email' => $this->email, 'recipient' => $this->when($this->isConsole, fn (): string => $this->recipient), 'phone' => new PhoneResource($this->resource), 'locations' => $this->locations, 'views' => $this->when( $this->isConsole, fn (): int => $this->resource->info()->select('id')->get()->count() ), 'registeredViews' => $this->when($this->isConsole, fn (): int => $this->views), 'mission' => $this->when( !is_null($this->mission), fn (): array => explode(PHP_EOL, $this->mission, 5) ), 'rodo' => $this->when( !is_null($this->rodo), $this->rodo ), 'position' => $this->when( !is_null($this->position), $this->position ), ]; } public function setAsConsole(): self { $this->isConsole = true; return $this; } }