Select::make('fees_description')
->label('الرسوم')
->preload()
->multiple()
->live()
->options(Fee::all()->pluck('name', 'id'))
->afterStateUpdated(function (Set $set, Get $get, $state) {
if (count($state)) {
$set('price', Fee::findMany($state)->sum('price'));
$set('sub_price', $this->getOwnerRecord()->addons()->sum('qty') * Fee::where('type', FeeTypeAttribute::MONTHLY->value)->findMany($get('fees_description'))->count());
$set('total', $get('price') + $this->getOwnerRecord()?->addons()->sum('qty') * Fee::where('type', FeeTypeAttribute::MONTHLY->value)->findMany($state)->count());
} else {
$set ('price', 0);
$set ('sub_price', 0);
$set ('total', 0);
}
}),
I have the following form in my relation manger in filament where i’m trying to update some fields base on the selected filed when ever i choose some Fees that are not monthly the component sends :
Livewire encountered corrupt data when trying to hydrate a component. Ensure that the [name, id, data] of the Livewire component wasn't tampered with between requests.
What is it i’m doing wrong?