Infolist RepeatableEntry view entry action.

Hi, I cant figure out how to make repeatable entries with action that opens entry in new tab. Check my code below. Why I cannot inject current repeatable entry in function:
RepeatableEntry::make('completedTestAttempts')
->label(false)
->state(function (User $student) {
return $student->completedTestAttempts()
->with(['exam', 'questions', 'category'])
->whereNotNull('completed_at')
->orderBy('completed_at', 'desc')
->limit(10)
->get()
->toArray();
})
->schema([
TextEntry::make('exam.name')
->label(__('Name')),
\Filament\Infolists\Components\Actions::make([
Action::make('overview')
->url(fn (TestAttempt $testAttempt): string => $testAttempt->getUrl())
->label(__('Overview'))
])
]),
RepeatableEntry::make('completedTestAttempts')
->label(false)
->state(function (User $student) {
return $student->completedTestAttempts()
->with(['exam', 'questions', 'category'])
->whereNotNull('completed_at')
->orderBy('completed_at', 'desc')
->limit(10)
->get()
->toArray();
})
->schema([
TextEntry::make('exam.name')
->label(__('Name')),
\Filament\Infolists\Components\Actions::make([
Action::make('overview')
->url(fn (TestAttempt $testAttempt): string => $testAttempt->getUrl())
->label(__('Overview'))
])
]),
2 Replies
varovas
varovasOP5mo ago
If anyone will need a solution, I was able to get current revord data through: $action->getComponent()->getState() which returned entry loop data
toeknee
toeknee5mo ago
Because it's passed to an array not a class? So fn($record) => would be the record array

Did you find this page helpful?