greatfortress
greatfortress
FFilament
Created by SyntaxErrar on 7/31/2023 in #❓┊help
Repeater Index
This isn't an exact solution to what you are looking for but something similar could be done. I wanted a repeater that used the index in the label so I overrode the getItemLabel method while extending the Repeater component.
<?php

namespace App\Forms\Components;

use Filament\Forms\Components\Repeater;
use Illuminate\Contracts\Support\Htmlable;

class IndexRepeater extends Repeater
{
public function getItemLabel(string $uuid): string | Htmlable | null
{

return $this->evaluate($this->itemLabel, [
'state' => $this->getChildComponentContainer($uuid)->getRawState(),
'index' => (string) array_search($uuid, array_keys($this->getState())),
'uuid' => $uuid,
]);
}

}
<?php

namespace App\Forms\Components;

use Filament\Forms\Components\Repeater;
use Illuminate\Contracts\Support\Htmlable;

class IndexRepeater extends Repeater
{
public function getItemLabel(string $uuid): string | Htmlable | null
{

return $this->evaluate($this->itemLabel, [
'state' => $this->getChildComponentContainer($uuid)->getRawState(),
'index' => (string) array_search($uuid, array_keys($this->getState())),
'uuid' => $uuid,
]);
}

}
4 replies
FFilament
Created by greatfortress on 3/10/2023 in #❓┊help
Trigger Page Reload from Admin Resource?
@saadeguilherme brilliant! Thank you. This definitely seems like it should solve the problem.
11 replies