Yacoub Al-haidari
multiple() select not work with afterStateUpdated
Not work <
Select::make("attributevalues{$attributeId}")
->label("اختر قيمة الخاصية: " . $attribute->name)
->options(AttributeValue::where('attribute_id', $attributeId)->pluck('value', 'id')->toArray())
->required()
->multiple()
->dehydrated()
->native(true)
->live(onBlur: true)
->afterStateUpdated(function (Set $set, Get $get, $state) use ($attributeId) {
dd($state);
$attributeValues = $get('attribute_values') ?? [];
$attributeValues[$attributeId] = [$state];
$set('attribute_values', $attributeValues);
$colors = $get('colors') ?? []; $variants = generateVariants($colors, $attributeValues);
$set('Has_variants', $variants); })
$set('attribute_values', $attributeValues);
$colors = $get('colors') ?? []; $variants = generateVariants($colors, $attributeValues);
$set('Has_variants', $variants); })
34 replies
multiple() select not work with afterStateUpdated
I mean , I can not access to the afterStateUpdated when the multiple is enable i added the dd() and select the AttributeValues select box but no dd() works in side the afterStateUpdated
34 replies
multiple() select not work with afterStateUpdated
There is no error appear
This the video For what i am trying to make
https://www.loom.com/share/55c958ce385a49b78d9e3404fa998965?t=53&sid=fe5216de-b7bf-4d67-8cb3-5fd9071c860c
34 replies