F
Filament10mo ago
Prodex

Infolist with Array example?

Hi, I'm trying to use a repeatable entry with an array. But it doesn't seem to work. Is there an example on how this should look like? Thank you!
public function customerInfolist(Infolist $infolist): Infolist
{
return $infolist
->state([
2 => [
'expected' => 12457,
'booked' => 12457,
],
4 => [
'expected' => 12457,
'booked' => 12457,
],
])
->schema([
RepeatableEntry::make('customers')
->schema([
TextEntry::make('expected')
->label('Expected'),
TextEntry::make('booked')
->label('Booked'),
]),
]
);
}
public function customerInfolist(Infolist $infolist): Infolist
{
return $infolist
->state([
2 => [
'expected' => 12457,
'booked' => 12457,
],
4 => [
'expected' => 12457,
'booked' => 12457,
],
])
->schema([
RepeatableEntry::make('customers')
->schema([
TextEntry::make('expected')
->label('Expected'),
TextEntry::make('booked')
->label('Booked'),
]),
]
);
}
Solution:
GitHub
Infolist with RepeatableEntry and Array · filamentphp filament · Di...
I'm trying to use RepeatableEntry with an array. The docs mention that this should work, but it doesn't for me. I didn't find any example on this, unfortunately. Here's my code: pub...
Jump to solution
3 Replies
LeandroFerreira
LeandroFerreira10mo ago
I think you need to add on your repeatable
->getStateUsing(fn():array =>[...])
->getStateUsing(fn():array =>[...])
Prodex
Prodex10mo ago
okay, now I have two entries (which is better than before), but it doesn't output the actual data. It only shows the labels. current code:
public function customerInfolist(Infolist $infolist): Infolist
{
return $infolist
->state([
2 => [
'expected' => 12457,
'booked' => 12457,
],
4 => [
'expected' => 12457,
'booked' => 12457,
],
])
->schema([
RepeatableEntry::make('Customers')
->getStateUsing(fn(): array => [
2 => [
'expected' => 12457,
'booked' => 12457,
],
4 => [
'expected' => 12457,
'booked' => 12457,
],
])
->schema([
TextEntry::make('expected'),
TextEntry::make('booked'),
]),
]
);
public function customerInfolist(Infolist $infolist): Infolist
{
return $infolist
->state([
2 => [
'expected' => 12457,
'booked' => 12457,
],
4 => [
'expected' => 12457,
'booked' => 12457,
],
])
->schema([
RepeatableEntry::make('Customers')
->getStateUsing(fn(): array => [
2 => [
'expected' => 12457,
'booked' => 12457,
],
4 => [
'expected' => 12457,
'booked' => 12457,
],
])
->schema([
TextEntry::make('expected'),
TextEntry::make('booked'),
]),
]
);
Solution
LeandroFerreira
LeandroFerreira10mo ago
GitHub
Infolist with RepeatableEntry and Array · filamentphp filament · Di...
I'm trying to use RepeatableEntry with an array. The docs mention that this should work, but it doesn't for me. I didn't find any example on this, unfortunately. Here's my code: pub...