@php $id = 'f-'.$f['name']; $err = $errors->first($f['name']); $required = str_contains((string) ($f['rules'] ?? ''), 'required'); $max = null; if (preg_match('/max:(\d+)/', (string) ($f['rules'] ?? ''), $m)) { $max = (int) $m[1]; } @endphp