How to fetch current table records in table query

I am building a dynamic table, where I would like to use a list of the current records in the table I have queried. Here is a code snippet of the table I am building:
public static function table(Table $table): Table
{
  return $table
    ->query(GroupOrderResource::getEloquentQuery()
    ->whereDate('deadline', '=', now()->toDateString()))
    ->defaultSort('sort')
    ->reorderable('sort')
    ->columns([
      TextInputColumn::make('route')
        ->afterStateUpdated(function ($record) {
          OrderService::handleRouteChange($record);
        }),
      ]);
}

In my ->afterStateUpdated I would like to fetch and use the the query of all records in the table, without needing to run the query again:
GroupOrderResource::getEloquentQuery()->whereDate('deadline', '=', now()->toDateString())

Because my query could change based on filters in the future, so the easiest would be to fetch the records from the table dirctly.
Was this page helpful?