Skip to content
Discussion options

You must be logged in to vote

You should declare adsize_label only once and use multiple if else to set show() and options().

Select::make('AdSize', 'adsize_label')->options([])
  ->dependsOn('product_name', function ($field, $request, $formData) {
    if ($formData->product_name === 'A') { 
      $field->options(/* ... */)->show();
    } elseif ($formData->product_name === 'B') { 
      $field->options(/* ... */)->show();
    } else {
      $field->hide();
    }
  }),

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies

This comment has been minimized.

This comment has been minimized.

Comment options

You must be logged in to vote
1 reply
@elizdlt202
Comment options

Answer selected by elizdlt202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #4057 on April 20, 2022 20:43.