laravel model prevent lazy loading throw exception when using “whenLoaded()” for relation in resource

i recently start using Model::preventLazyLoading()
but it actually throws an error even when the relation is not loaded but it may be loaded sometimes

like this in resource 'discount' => $this->whenLoaded('meta', $this->meta->discount ?? 0),

laravel version: 9.17.0