Reuse infolist modal from resource on Notification view action

Is it possible to show an infolist modal from a Resource I have already defined ? I'm sending a notification to some user, with a "More details" button, and I would like to know if this is easily achievable, or I have to build the infolist separately.
Solution:
If you use a specific infolist setup in different places, you can create a reusable component to extract it.
Jump to solution
7 Replies
titoshadow
titoshadowOP3mo ago
No one? Is an obvious question?
Vp
Vp3mo ago
Not sure about you already defined. but you can display infolist instead of form in action:
Action::make()
->infolist(function ($record) {
dd($record)
}),
Action::make()
->infolist(function ($record) {
dd($record)
}),
titoshadow
titoshadowOP3mo ago
Thank you for answering! I'm talking about using an already created infolist (the one I defined on my ModelResource):
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
TextEntry::make('category'),
TextEntry::make('source_ip'),
TextEntry::make('source_port'),
...
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
TextEntry::make('category'),
TextEntry::make('source_ip'),
TextEntry::make('source_port'),
...
from what you wrote, I understand I would be generating a new empty infolist, right ? Thats not what I'm asking for. Instead, I'm talking about something like ExampleResource::getInfolist()
titoshadow
titoshadowOP2mo ago
Stack Overflow
How to reuse a Resource infoList method in another Resource in Lara...
I'm working on a Laravel project using Filament. I have two models: User and Car. Each Car belongs to a specific User. I want to display user information on the Car page by using the infoList defin...
Solution
CodeWithDennis
CodeWithDennis2mo ago
If you use a specific infolist setup in different places, you can create a reusable component to extract it.
CodeWithDennis
CodeWithDennis2mo ago
Maybe this works (not tested)
public static function infolist(Infolist $infolist): Infolist
{
return YourResource::infolist($infolist);
}
public static function infolist(Infolist $infolist): Infolist
{
return YourResource::infolist($infolist);
}
titoshadow
titoshadowOP2mo ago
For the record:
class CustomInfolist extends Component
{
return [ ... ];
}
class CustomInfolist extends Component
{
return [ ... ];
}
Thank you very much !
Want results from more Discord servers?
Add your server