I’m trying to use this package: https://packagist.org/packages/digital-creative/conditional-container
. However with this basic example:
return array_merge(
[
Select::make('Option', 'option')
->options([
1 => 'Option 1',
2 => 'Option 2',
3 => 'Option 3',
]),
/**
* Only show field Text::make('Field A') if the value of option is equals 1
*/
ConditionalContainer::make([ Text::make('Field A') ])->if('option = 1'),
Text::make('Title'),
Textarea::make('Description'),
],
$arr
);
I’m getting the error message: Call to a member function toArray() on array
.
If I change to:
return array_merge(
[
[
Select::make('Option', 'option')
->options([
1 => 'Option 1',
2 => 'Option 2',
3 => 'Option 3',
]),
ConditionalContainer::make([ Text::make('Field A') ])->if('option = 1')
],
It shows:
message: "Call to a member function getUpdateRules() on array"
even with only the example like below it shows "message: "Call to a member function toArray() on array":
public function definition(): array
{
return [
Select::make('Option', 'option')
->options([
1 => 'Option 1',
2 => 'Option 2',
3 => 'Option 3',
]),
ConditionalContainer::make([ Text::make('Field A') ])->if('option = 1')
];
}
Do you know how to solve the issue? Thanks!