F
Filament15mo 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
LeandroFerreira15mo ago
I think you need to add on your repeatable
->getStateUsing(fn():array =>[...])
->getStateUsing(fn():array =>[...])
Prodex
ProdexOP15mo 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
LeandroFerreira15mo 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...
Want results from more Discord servers?
Add your server