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

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?



Solution 1:[1]

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']);
            }
        }
    ),

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mahen Nakar