$items = $this->getItems();$total = 0;foreach ($items as $item) { if (isset($item['propertyA']) && $item['propertyA'] !== '0' && isset($item['propertyB'])) { $total += (int) $item['propertyB']; } else { $total += 0; }}if ($total > 100) { throw ValidationException::withMessages(['items' => __('Total percentage cannot exceed 100%')]);}if ($total < 50) { throw ValidationException::withMessages(['items' => __('Total percentage must be 50% or more')]);}
public ?string $name = null;
$this->form->fill([ 'fieldName' => 'fieldValue', ])