Muetze42 / nova-radio-field

A Radio Buttons field for Laravel Nova.
https://novapackages.com/packages/norman-huth/nova-radio-field
MIT License
5 stars 2 forks source link

Illegal offset type in isset or empty #20

Closed CodeWithDennis closed 1 year ago

CodeWithDennis commented 1 year ago

Not sure if this is on my end but since the new Nova update im getting the following error:

Illegal offset type in isset or empty -> vendor/norman-huth/nova-radio-field/src/Radio.php -> line: 244

->dependsOn(['type'], function (Radio $field, NovaRequest $request, FormData $formData) {
   if ($formData->type == 'test') { $field->options('test'=> 'Test']); }
})

Error occurs when using: v4.25.0 (Silver Surfer)

Muetze42 commented 1 year ago

Tested with Nova 4.25.0 and 4.25.1 and Radio field 1.1.9.

https://nova-demo.huth.it/resources/nova-radio-field-radios/3/edit

https://github.com/Muetze42/laravel-nova-demo-app/blob/main/app/Nova/Resources/NovaRadioFieldRadio.php#L197


You have a syntax error:

->dependsOn(['type'], function (Radio $field, NovaRequest $request, FormData $formData) {
    if ($formData->type == 'test') { $field->options(/* Missing --> */ [ /* <-- Missing */'test'=> 'Test']);}
})
CodeWithDennis commented 1 year ago

Yea sorry i edited the code only in this message (not actually code) that doesn't seem to be the problem. Actual problem is no longer present when using v4.24.4

Have you tried using a Radio DependsOn on another Radio?

CodeWithDennis commented 1 year ago

Have you tried using the Radio fields on another Radio field?

Muetze42 commented 1 year ago

Sorry that it takes a while at the moment. I am actually on vacation. 🏝️

Live: https://nova-demo.huth.it/resources/nova-radio-field-radios/5/edit

Code: https://github.com/Muetze42/laravel-nova-demo-app/blob/main/app/Nova/Resources/NovaRadioFieldRadio.php#L201

Dependencies of the Demo App: image

CodeWithDennis commented 1 year ago

Once i am upgrading to the new Nova Version: Upgrading laravel/nova (4.24.4 => 4.25.1) see following video:

https://github.com/Muetze42/nova-radio-field/assets/23448484/7157ce22-211c-4d3f-969e-28bda42db340

Don't have to look now tho, enjoy the holidays =)