Prodex
Prodex
FFilament
Created by Prodex on 10/28/2024 in #❓┊help
ExtraModalFooterAction does nothing
Hi, I'm trying to render an extra action for the editOptionModal:
->editOptionAction(fn (Forms\Components\Actions\Action $action) => $action->extraModalFooterActions(fn (Action $action): array => [
\Filament\Actions\Action::make('something')
->icon('heroicon-o-trash')
->action(fn ($record) => dump($record)),
]))
->editOptionAction(fn (Forms\Components\Actions\Action $action) => $action->extraModalFooterActions(fn (Action $action): array => [
\Filament\Actions\Action::make('something')
->icon('heroicon-o-trash')
->action(fn ($record) => dump($record)),
]))
The button renders as it should, but when I click it, nothing happens. No php or js errors as well. How can I fix that? Thanks!
6 replies
FFilament
Created by Prodex on 10/8/2024 in #❓┊help
Weird override behavior
Hi, I'm overriding the Shield resource, so I don't have to publish the stubs. But I just don't understand why some methods can be overwritten but some others not. For example: I can easierly overwrite shouldRegisterNavigation() or getNavigationLabel(), but I can't overwrite getPluralModelLabel(). Both getNavigationLabel() and getPluralModelLabel() are used the same way in the base Shield resource. But only getNavigationLabel() works, the other method (getPluralModelLabel) doesn't even get called. Can someone explain to me, why this is happening? Full code:
class ShieldOverrideResource extends RoleResource
{
public static function getModelLabel(): string
{
return __('employee.permission_roles'); // doesn't work
}

public static function getPluralModelLabel(): string
{
return 'test'; // doesn't work
}

public static function getNavigationLabel(): string
{
return 'test'; // works
}

public static function getNavigationParentItem(): string
{
return __('employee.plural'); // works
}

public static function shouldRegisterNavigation(): bool
{
return true; // works
}
}
class ShieldOverrideResource extends RoleResource
{
public static function getModelLabel(): string
{
return __('employee.permission_roles'); // doesn't work
}

public static function getPluralModelLabel(): string
{
return 'test'; // doesn't work
}

public static function getNavigationLabel(): string
{
return 'test'; // works
}

public static function getNavigationParentItem(): string
{
return __('employee.plural'); // works
}

public static function shouldRegisterNavigation(): bool
{
return true; // works
}
}
For reference, this is the shield base class resource:
public static function getPluralModelLabel(): string
{
return __('filament-shield::filament-shield.resource.label.roles');
}

public static function getNavigationLabel(): string
{
return __('filament-shield::filament-shield.nav.role.label');
}
public static function getPluralModelLabel(): string
{
return __('filament-shield::filament-shield.resource.label.roles');
}

public static function getNavigationLabel(): string
{
return __('filament-shield::filament-shield.nav.role.label');
}
3 replies
FFilament
Created by Prodex on 7/8/2024 in #❓┊help
Using Tabs outside of resources
Is it somehow possible to use tabs to filter a table, without having a resource? If so, are there any code examples? 🙏 Thank you!
2 replies
FFilament
Created by Prodex on 7/2/2024 in #❓┊help
Checkboxlist set all true by default
Is there a way to set all options to true by default? Without the need to specify the options one by one.
1 replies
FFilament
Created by Prodex on 6/12/2024 in #❓┊help
First Action Modal doesn't close
I've implemented a delete action for the editOptionForm like so:
Forms\Components\Select::make('location_id')
->label('Location')
->relationship('location', 'name')
->required()
->searchable()
->preload()
->createOptionForm([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),
])
->editOptionForm([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),
])
->editOptionAction(fn (Forms\Components\Actions\Action $action, $record) => $action
->extraModalFooterActions([
DeleteAction::make()
->record($record)
->cancelParentActions(),
]),
),
Forms\Components\Select::make('location_id')
->label('Location')
->relationship('location', 'name')
->required()
->searchable()
->preload()
->createOptionForm([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),
])
->editOptionForm([
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),
])
->editOptionAction(fn (Forms\Components\Actions\Action $action, $record) => $action
->extraModalFooterActions([
DeleteAction::make()
->record($record)
->cancelParentActions(),
]),
),
But the confirmation modal for the delete action is behind the edit modal, because the edit modal doesn't close. Even when using cancelParentActions. How can I make it, so the edit modal closes? Thank you!
1 replies
FFilament
Created by Prodex on 6/10/2024 in #❓┊help
Custom recordAction()
Hi, how can I trigger a custom action when a record is clicked? There is ->recordAction('myaction'); But this doesn't trigger it. Instead, the edit action is still triggered.
$table->actions([
Tables\Actions\Action::make('myaction')
->infolist([
Pages\ViewHardware::list(),
])
->slideOver()
->modalCancelAction(false)
->modalSubmitAction(false),
Tables\Actions\EditAction::make(),
])
$table->actions([
Tables\Actions\Action::make('myaction')
->infolist([
Pages\ViewHardware::list(),
])
->slideOver()
->modalCancelAction(false)
->modalSubmitAction(false),
Tables\Actions\EditAction::make(),
])
4 replies
FFilament
Created by Prodex on 5/17/2024 in #❓┊help
Cache Action (Modal) Response
Hi, is it possible to cache the response of filament table actions (modals) for a certain amount of time? Background: I've got a project that has a page which can experience a lot of traffic and I would like to keep the responses as tiny as possible. Because livewire makes additonal requests when a modal gets shown, I want to improve that as well.
2 replies
FFilament
Created by Prodex on 5/10/2024 in #❓┊help
How can I avoid N+1 problem in custom views?
As described in the docs I use a custom view for a table column and I'm using $getRecord() to access the eloquent model. This however makes an N+1 problem, because for every record displayed in the table the $getRecord() method retrieves the data from the database again. How can I avoid this? Thank you!
5 replies
FFilament
Created by Prodex on 4/26/2024 in #❓┊help
How to show a slideover infolist view when clicking a row in a resource table?
Can anyone provide code examples for something like that? Thanks!
7 replies
FFilament
Created by Prodex on 3/26/2024 in #❓┊help
Gantt Chart with Livewire / Filament / AlpineJS
Does anyone know a good package to build a gantt chart in filament, where the user can also interact with the items?
3 replies
FFilament
Created by Prodex on 2/28/2024 in #❓┊help
"Remember Me" with Socialite
When using Socialite, how should "remember me" work? If "remember" is set to true in Auth::login() the cookie gets set, but after the normal session times out, the middleware "AuthenticateSession" checks if a password hash is present. Because there's no password hash when using socialite, it always falls back to ->logout(). Anyone knows how to handle this correctly, without logging the user out?
1 replies
FFilament
Created by Prodex on 2/9/2024 in #❓┊help
Include JS Asset: "Identifier X has already been declared"
If I include JavaScript like the docs say, it doesn't bundle it through vite, so this doesn't work:
FilamentAsset::register([
Js::make('sentry', __DIR__ . '/../../resources/js/sentry.js'),
]);
FilamentAsset::register([
Js::make('sentry', __DIR__ . '/../../resources/js/sentry.js'),
]);
If I use the Vite facade it does load the correct file, but I get "Identifier X has already been declared", because vite doesn't know, that there are other assets as well.
FilamentAsset::register([
Js::make('sentry', Vite::asset('resources/js/sentry.js')),
]);
FilamentAsset::register([
Js::make('sentry', Vite::asset('resources/js/sentry.js')),
]);
How can I avoid this problem?
3 replies
FFilament
Created by Prodex on 2/9/2024 in #❓┊help
Collapsable column, but keeping the normal layout
Hi, is it somehow possible to have a column that is below the row which can be collapsed to add extra information, but keeping the "normal" layout (where each column has a title / label above)? If I use split() or stack(), it messes up my table and more importantly: the labels are gone. But in my case, I still need those. Thank you!
3 replies
FFilament
Created by Prodex on 1/17/2024 in #❓┊help
Calling Action Modal from parent livewire component
Hi, I'm having a "card" livewire component that's inside a loop from the parent component. The card component has a delete action with confirmation. The docs say the <x-filament-actions::modals /> needs to be in the same component as the action and that's true. However, if I do it like this, a modal gets rendered for each card, instead of just having one. Is there any better solution for this? Like calling the modal from the parent?
9 replies
FFilament
Created by Prodex on 1/11/2024 in #❓┊help
Sub Navigation in ListView for Custom Page
Hi, I want to display a sub navigation in the ListView for a custom page (which does not interact with any record). I have a subnavigation for my records setup already in my CustomerResource:
public static function getRecordSubNavigation(Page $page): array
{
return $page->generateNavigationItems([
Pages\Overview::class,
Pages\Projects::class,
]);
}

public static function getPages(): array
{
return [
'index' => Pages\ListCustomers::route('/'),
'overview' => Pages\Overview::route('/{record}'),
'projects' => Pages\Projects::route('/{record}/projects'),
];
}
public static function getRecordSubNavigation(Page $page): array
{
return $page->generateNavigationItems([
Pages\Overview::class,
Pages\Projects::class,
]);
}

public static function getPages(): array
{
return [
'index' => Pages\ListCustomers::route('/'),
'overview' => Pages\Overview::route('/{record}'),
'projects' => Pages\Projects::route('/{record}/projects'),
];
}
But how can I display a sub navigation on the ListCustomers Page for a custom Page? Thank you!
4 replies
FFilament
Created by Prodex on 1/8/2024 in #❓┊help
QueryBuilder Filter returns nothing
Hi, I have this simple RealtionshipContraint in my filter querybuilder. The items of the relation is displayed correctly in the select, but if one item is select with "is" operator, it doesn't return anything. To double check: It disabled / removed all other filters to avoid possible conflicts. But it still doesn't work:
QueryBuilder::make()
->constraints([
QueryBuilder\Constraints\TextConstraint::make('customer.name'),
QueryBuilder\Constraints\RelationshipConstraint::make('article')
->emptyable()
->selectable(QueryBuilder\Constraints\RelationshipConstraint\Operators\IsRelatedToOperator::make()
->titleAttribute('title'))]),
QueryBuilder::make()
->constraints([
QueryBuilder\Constraints\TextConstraint::make('customer.name'),
QueryBuilder\Constraints\RelationshipConstraint::make('article')
->emptyable()
->selectable(QueryBuilder\Constraints\RelationshipConstraint\Operators\IsRelatedToOperator::make()
->titleAttribute('title'))]),
"is empty" and "is not empty" works. The relationship itself works too, when it is used in other filters or fields. Can anyone help?
4 replies
FFilament
Created by Prodex on 12/22/2023 in #❓┊help
summarizer "all pages" custom record title attribute for
No description
3 replies
FFilament
Created by Prodex on 12/20/2023 in #❓┊help
Multiple columns of same attribute
Hi, how can I use the same attribute multiple times in a table? For example: I have a invoice table, which has "month" and "year" as column, but the data comes from the "date" attribute of the model, just with a different format. Thanks!
3 replies
FFilament
Created by Prodex on 11/30/2023 in #❓┊help
Sub-Navigation top position
Is it possible to get the top sub-navigation above the page title and breadcrumb, instead of having it below? It would make more sense for my use case (and maybe a lot of other use cases). Thank you!
5 replies
FFilament
Created by Prodex on 10/19/2023 in #❓┊help
Adding filter to custom widget
Hi, how can I implement a filter (start and end date) to a custom widget? Should I use a custom action for that or can I utilize filament filters for that? Thank you!
4 replies