You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✏️ Describe the bug
When using the data object in Livewire wire:model.live="startupRule.daysActive" it produces an exception on model update. We are using it in a input checkbox.
↪️ To Reproduce
classPowerscheduleRuleDataextendsData
{
public ?array$daysActive = [];
}
2024-08-09 10:58:25] local.ERROR: Spatie\LaravelData\Support\Livewire\LivewireDataSynth::get(): Return value must be of type Spatie\LaravelData\Contracts\BaseData, array returned {"userId":"4","exception":"[object] (TypeError(code: 0): Spatie\\LaravelData\\Support\\Livewire\\LivewireDataSynth::get(): Return value must be of type Spatie\\LaravelData\\Contracts\\BaseData, array returned at /var/www/html/vendor/spatie/laravel-data/src/Support/Livewire/LivewireDataSynth.php:35)
I was able to fix it by editingthe get(&$target, $key) in LivewireDataSynth and by removing the return value BaseData typecast:
✏️ Describe the bug
When using the data object in Livewire
wire:model.live="startupRule.daysActive"
it produces an exception on model update. We are using it in a input checkbox.↪️ To Reproduce
I was able to fix it by editingthe
get(&$target, $key)
inLivewireDataSynth
and by removing the return valueBaseData
typecast:But not sure if that is the correct solution.
✅ Expected behavior
Laravel data to work with Livewire in two way binding.
🖥️ Versions
Laravel: 11.16.0
Laravel Data: 4.7.2
PHP: 8.2
Livewire: 3.5.4
The text was updated successfully, but these errors were encountered: