How to set custom data to RepeatableEntry inside infolist?

I'm just started with Filament and don't understand key concepts how to build anything. I have a simple View page for my resource, data came from Eloquent (MySQL), but extra data I need is from Service (ElasticSearch inside with some logic behind). How to deal with that? $messages is simple array of key->value (type, from...) and now all TextEntry are empty.
class ViewConversation extends ViewRecord
{
protected static string $resource = ConversationResource::class;

public function infolist(Infolist $infolist): Infolist
{
/** @var ESStorage $es */
$es = app(ESStorage::class);

$messages = $es->getConversationHistory($this->record->bot_id, $this->record->id);

$messagesEntry = RepeatableEntry::make('messages')
->default($messages)
->schema([
TextEntry::make('type'),
TextEntry::make('from'),
TextEntry::make('timestamp'),
TextEntry::make('message'),
]);

return parent::infolist($infolist)->schema([
Section::make('Details')->schema([
TextEntry::make('id'),
TextEntry::make('bot.name')->url(fn() => ChatbotResource::getUrl('edit', [$this->record->bot_id])),
TextEntry::make('created_at')->dateTime(),
]),
$messagesEntry,
]);
}
}
class ViewConversation extends ViewRecord
{
protected static string $resource = ConversationResource::class;

public function infolist(Infolist $infolist): Infolist
{
/** @var ESStorage $es */
$es = app(ESStorage::class);

$messages = $es->getConversationHistory($this->record->bot_id, $this->record->id);

$messagesEntry = RepeatableEntry::make('messages')
->default($messages)
->schema([
TextEntry::make('type'),
TextEntry::make('from'),
TextEntry::make('timestamp'),
TextEntry::make('message'),
]);

return parent::infolist($infolist)->schema([
Section::make('Details')->schema([
TextEntry::make('id'),
TextEntry::make('bot.name')->url(fn() => ChatbotResource::getUrl('edit', [$this->record->bot_id])),
TextEntry::make('created_at')->dateTime(),
]),
$messagesEntry,
]);
}
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server