Tables\Actions\BulkAction::make('bulk_archive') ->label('Archive') ->visible(fn ($livewire): bool => $livewire->activeTab !== 'archived' && $livewire->activeTab === 'new' ))
->visible(!getQueryStringParamValue('activeTab') || getQueryStringParamValue('activeTab') !== "is_archived")
if (!function_exists('getQueryStringParamValue')) { function getQueryStringParamValue($param = null) { if (!$param) return null; // Get the referer from the server array $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; // Parse the URL to get the query string $queryString = parse_url($referer, PHP_URL_QUERY); // Initialize an array to store parameters $paramsArray = []; // Parse the query string to get individual parameters parse_str($queryString, $paramsArray); // Get the value of the parameter return isset($paramsArray[$param]) ? $paramsArray[$param] : null; }}
In Action of Bulk Action: ->action(function (Collection $records, \Mavinoo\Batch\Batch $batch): void { if (getQueryStringParamValue('activeTab') && getQueryStringParamValue('activeTab') === "is_archived") { Notification::make('check_archived') ->title('Selected records are already archived.') ->warning() ->send(); return; });