Laravel Nova Dependency Container what are the allowed resource properties other than id in dependsOn

Viewed 429

I have a belongsTo field on the selection of which i want to show/hide another field using nova dependency container. But it only allows to give id in the dependsOn('page.id', 1) but i want to show the field on the basis of page status like dependsOn('page.status', 'active').

Is there a way to do this?

1 Answers

if you are using laravel nova 4 , there is a callback function and you can manipulate it as per your requirement

Text::make('Recipient')
    ->hide()
    ->dependsOn(
        ['type'], 
        function (Text $field, NovaRequest $request, FormData $formData) {
            if ($formData->type === 'gift') {
                $field->show()->rules(['required', 'email']);
            }
        }
    ),
Related