Skip to content

Validation rules not working with exclude_unless / exclude_if Validation Rule for Resource #3498

@airdev-web

Description

@airdev-web

Greetings from Belgium !

  • Laravel Version: 8.51.0
  • Nova Version: 3.26.1
  • PHP Version: 7.4

Description:

Can't use Laravel Validation rules exclude_unless (or even with exclude_if).
I need my field allergens to be required only if my field is_active is true.

Following code doesn't seem to work. No error code, but the validation doesn't work.

Detailed steps to reproduce the issue on a fresh Nova installation:

Boolean::make('Actif', 'is_active'),
Textarea::make('Allergènes', 'allergens')
    ->rules('exclude_if:is_active,true|required'),

// I also tried this
Textarea::make('Allergènes', 'allergens')
    ->rules('exclude_if:is_active,true', 'required'),

Thanks for the ideas or correct usage,
Romain

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions