string('title')->value(), text: $this->filled('text') ? $this->string('text')->value() : null, picture: $this->resolvePicture(), pictureAlt: $this->filled('picture_alt') ? $this->string('picture_alt')->value() : null, pictureTitle: $this->filled('picture_title') ? $this->string('picture_title')->value() : null, link: $this->filled('link') ? $this->string('link')->value() : null, linkLabel: $this->filled('link_label') ? $this->string('link_label')->value() : null, linkNewTab: $this->boolean('link_new_tab'), connected: $this->boolean('connected'), period: $this->toDatePeriod(), ); } #[\Override] public function rules(): array { $rules = parent::rules(); /** @var \App\Models\Slide|null $slide */ $slide = $this->route('slide'); if ($slide && ! empty($slide->picture)) { $rules['text'] = ['nullable', 'string', 'min:4']; } return $rules; } }