Nate
Nate
FFilament
Created by Nate on 11/27/2023 in #❓┊help
Is there a way to intercept the activeTab parameter in the resource table function?
I want to change the table structure depending on the tab that was just clicked. I can get the value after you leave the tab using $table->getLivewire()->activeTab (as the tab is probably only available after the table has rendered). I would like to do something like:
public static function table(Table $table): Table
{
if ($activeTab === 'Tab One') {
return (new TableConfigurationOne($table));
} // and more...

return (new TableConfigurationDefault($table));
}
public static function table(Table $table): Table
{
if ($activeTab === 'Tab One') {
return (new TableConfigurationOne($table));
} // and more...

return (new TableConfigurationDefault($table));
}
TIA
14 replies
FFilament
Created by Nate on 11/10/2023 in #❓┊help
Tab change event
Currently clicking a tab changes the query for the list page but I also want to change the option in Table bulk actions. Is this possible? I wan't to change the bulk actions depending on the activeTab query param WITHOUT a page reload.
public function getTabs(): array
{
return [
null => ListRecords\Tab::make('All'),
'new' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'new')),
'processing' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'processing')), // Clicking this will emit event?
];
}
public function getTabs(): array
{
return [
null => ListRecords\Tab::make('All'),
'new' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'new')),
'processing' => ListRecords\Tab::make()->query(fn ($query) => $query->where('status', 'processing')), // Clicking this will emit event?
];
}
->groupedBulkActions([
// Check active tab or listen for tab change event to change the action?
Tables\Actions\DeleteBulkAction::make()
->action(function () {
Notification::make()
->title('Only show on new tab')
->warning()
->send();
}),
Tables\Actions\DeleteBulkAction::make()
->action(function () {
Notification::make()
->title('Only show on processing tab')
->warning()
->send();
}),
])
->groupedBulkActions([
// Check active tab or listen for tab change event to change the action?
Tables\Actions\DeleteBulkAction::make()
->action(function () {
Notification::make()
->title('Only show on new tab')
->warning()
->send();
}),
Tables\Actions\DeleteBulkAction::make()
->action(function () {
Notification::make()
->title('Only show on processing tab')
->warning()
->send();
}),
])
8 replies
FFilament
Created by Nate on 7/13/2023 in #❓┊help
Switching Database Connection on a Resource
Hey filaments, I have a multi-tenancy database and I want to run actions on tenants. I have a TenancyResource and on the list page I was thinking about making that the entry point to manage tenants. So you click one of the tenants in the list and go to its view page and using relationship managers and some custom pages I though maybe there would be a good oprtunity to switch database context. Once you've clicked on a tenant I would have a list page with tabs to show user lists and and other stuff as well as actions to create records. What would be the best to achieve this. At what point, middleware wise or in the filament lifecycle can I switch DB context? Thanks ❤️
3 replies
FFilament
Created by Nate on 6/7/2023 in #❓┊help
Tab that contains a form that is always editable?
I have a tab with a form inside on my resource page. The only problems is you can only access the fields when the form is in create or edit mode. This custom tab contains a form to upload something to S3 and I need the fields always editable even when resource isn't in create or edit mode. Is this possible? Kind Regards Nate
8 replies