Custom Page

I've added a custom page to my EventResource, specifically the
take-attendance


public static function getPages(): array
    {
        return [
            'index' => Pages\ListEvents::route('/'),
            'create' => Pages\CreateEvent::route('/create'),
            'view' => Pages\ViewEvent::route('/{record}'),
            'edit' => Pages\EditEvent::route('/{record}/edit'),
            'take-attendance' => Pages\TakeAttendance::route('/{record}/take-attendance'),
        ];
    }


I implemented the HasInfolist

class TakeAttendance extends Page implements HasInfolists
{
    use InteractsWithRecord;

    public static function infolist(Infolist $infolist): Infolist
    {
        return $infolist
            ->record(Event::first())
            ->schema([]);
}


When I browse this userl admin/events/1/take-attendance , how can I get the Event data that has an ID of 1 and put it in my
->record(SpecificEvent Here)
So that I can use it in viewing data
Solution
static methods are for resources to be retrieved by the "page" class later. If you declare directly in the page class, it should be public function infolist(Infolist $infolist): Infolist
Was this page helpful?