Table custom query, where from request path.

I have a table with sub-entities. I wan't to display only limited list of sub-entities based on param from request path:

http://localhost:3005/admin/events/43

->query(Member::query()
    ->where('event_id', request()->route()->parameter('record'))
)


This renders well, however the form contains one action. When I click on this action:

->actions([
    Tables\Actions\Action::make('accept')
        ->translateLabel()
        ->action(static fn(Member $record) => $record->approve())
        ->modalSubmitActionLabel(__('Accept'))
        ->modalHeading(__('Accept Member'))
        ->modalContent(fn(Member $record): View => view(
            'livewire.show-member',
            [
                'event' => $record->event,
                'record' => $record,
            ],
        ))
        ->hidden(static fn(Member $record) => $record->is_approved),
])


The form for some reason is reloading with the request path of POST/PUT action, which doesn't have my argument.

The question is: why does it reload the form? Is it the expected behavior of the framework?
Solution
Thank you, it works! For the history:
    public int $eventId;

    public function mount(): void
    {
        $this->eventId = (int) request()->route()->parameter('record');
    }

    public function table(Table $table): Table
    {
        return $table
            ->query(Member::query()
                ->where('event_id', $this->eventId)
            )
//...
Was this page helpful?