->afterStateUpdated(function (Get $get, Set $set, ?string $old, ?string $state) {
$type = $get('type');
if($type == null || $get('product_id') == null) { return $set('price', 0); }
if ($type == 0) {
$set('price', Auth::user()->team()->products()->where('id', $get('product_id'))->first()->price);
return $set('itemTotal', $get('price') * $get('quantity'));
}
$set('price', Auth::user()->team()->services()->where('id', $get('product_id'))->first()->price);
return $set('itemTotal', $get('price') * $get('quantity'));
}),
->afterStateUpdated(function (Get $get, Set $set, ?string $old, ?string $state) {
$type = $get('type');
if($type == null || $get('product_id') == null) { return $set('price', 0); }
if ($type == 0) {
$set('price', Auth::user()->team()->products()->where('id', $get('product_id'))->first()->price);
return $set('itemTotal', $get('price') * $get('quantity'));
}
$set('price', Auth::user()->team()->services()->where('id', $get('product_id'))->first()->price);
return $set('itemTotal', $get('price') * $get('quantity'));
}),