abkrim
3 months ago
507
2
Nova

Nova field validate using data of other field

Posted 3 months ago by abkrim

Hi.

I have a text field (email) that needs to be validated with the value of a BelongsTo relationship

Text::make(__('Mailbox'), 'username')
    ->sortable()
    ->rules('required', 'email', 'max:254')
    ->creationRules('unique:mailboxes,username')
    ->readonly(function() {
        return $this->resource->id ? true : false;
    }),
...
BelongsTo::make('Domain')->hideFromDetail()->hideWhenUpdating(),

I need that user validate a mailbox with a valid email of same domain selected in BelongsTo.

Is possible ?

Please sign in or create an account to participate in this conversation.