klepak / nova-depend-fill

Fill Laravel Nova field based on value from other field
5 stars 13 forks source link

How can I access fields values in action #11

Open scramatte opened 2 years ago

scramatte commented 2 years ago

Hello,

How can I access fields values in an action?

Using your example, I'm unable get form values in "public function handle(ActionFields $fields, Collection $models)" method. $fields->text is empty.

DependFill::make('Text')
    ->field(
        Textarea::make('Text')
    )
    ->dependsOn(
        Select::make('Template')
            ->options([
                1 => 'Template 1',
                2 => 'Template 2',
            ])
    )
    ->values([
        1 => 'template 1 text',
        2 => 'template 2 text'
    ])