Checklist values

Hi, I'm trying to show fields based on checklist selection, but I'm not sure how to retrieve those selected values. When using Radio it's much easier because I use: ->visible(fn (Get $get): bool => $get('question1') === 'yes') but how to do the same using CheckList ? I know checklist returns an array but not sure how to it
Solution:
Loop the value of the checkbox list and if the array contains one of the values return true. Probably don’t even have to loop if you use laravel’s Arr facade. Arr::exists()
Jump to solution
2 Replies
Solution
awcodes
awcodes15mo ago
Loop the value of the checkbox list and if the array contains one of the values return true. Probably don’t even have to loop if you use laravel’s Arr facade. Arr::exists()
ingmontoya
ingmontoyaOP15mo ago
thanks @awcodes I made it in this way and it's working ->visible(fn ($get) => in_array('yes', $get('questions')))
Want results from more Discord servers?
Add your server