Automatic count repeater item

Hello, I tried to count how many items the user input in the repeater so that at the end of the form can show how many they already listed
->schema([
TextInput::make("number_of_fields")
->label("Jumlah Pendaftar")
->disabled()
>placeholder(fn (Get $get) => count($get('participant'))),,
]),
->schema([
TextInput::make("number_of_fields")
->label("Jumlah Pendaftar")
->disabled()
>placeholder(fn (Get $get) => count($get('participant'))),,
]),
but nothing shows up with this error
TypeError
PHP 8.2.12
10.46.0
count(): Argument #1 ($value) must be of type Countable|array, null given
TypeError
PHP 8.2.12
10.46.0
count(): Argument #1 ($value) must be of type Countable|array, null given
this is my repeater name
Repeater::make('participant')
Repeater::make('participant')
Thank you for your help!
Solution:
i use this alternative https://laraveldaily.com/post/filament-repeater-live-calculations-on-update ```php $count = collect($get('participant'))->filter(fn($item) => !empty($item['nameParticipant']));...
Jump to solution
1 Reply
Solution
thyk123
thyk1233mo ago
i use this alternative https://laraveldaily.com/post/filament-repeater-live-calculations-on-update
$count = collect($get('participant'))->filter(fn($item) => !empty($item['nameParticipant']));
$count = collect($get('participant'))->filter(fn($item) => !empty($item['nameParticipant']));