Parameter being null after table action

I have a widget that refreshes the page with a custom parameter. I use this parameter to manipulate a different widget, which needs a page refresh. And to update the getTableQuery method.
protected function getTableQuery(): Builder
    {
        if (Request::query('location')) {
            switch (Request::query('location')){
                case 'all': return parent::getTableQuery();
                case 'allDeleted': {
                    return Asset::onlyTrashed();
                }
                default: {
                    $location = Location::findOrFail(Request::query('location'));
                    $assetIds = $location->assets->pluck('id')->toArray();
                    return parent::getTableQuery()->whereIn('id', $assetIds);
                }
            }
        }
        dd(Request::query('location'));
        $location =  Location::first();
        if ($location) {
            $assetIds = $location->assets->pluck('id')->toArray();
            return parent::getTableQuery()->whereIn('id', $assetIds);
        }
        return parent::getTableQuery();
    }

This is working fine on the initial loading of the page, as you would expect the Request::query('location') is present and it applies the correct filters. The problem comes when trying to do a table action like delete, restore or any custom action. Then it is null, as i can see using the dd method. Why might this be and how can i make it so it will detect the location.
Was this page helpful?