danzzz
Exporter: Modify Query based on Options?
Can I modify my exporter query based on additional options I have added to the form, next to the columns selection? In my case I have a Resource with transactional data. Each row has a column for an account, for example bank account or paypal account. I want to give the user the option if he wants to export the data off all accounts or just of certain accounts.
I want to use getOptionsFormComponents() to add a multi select field where he can choose the accounts.
But I have no idea how to use it in the query modifier used at the Action Button.
2 replies
Use Spatie Translate language in Tables / Forms
I use spatie translate and can switch the language in my resources. I want to use the current language (not global language of laravel) in the table or forms. i mean the value of the language switcher. is that possible?
4 replies
renderHook scope dont work
dont't work, shows nowhere, should show on the table in the TransactionResource
->renderHook(
'tables::toolbar.search.before', fn (): View => view('filament.teste'), scopes: TransactionResource::class
)
works on all tables:
->renderHook(
'tables::toolbar.search.before', fn (): View => view('filament.teste')
)
anything wrong here with first snippet?5 replies
Editing Spatie Tags
I am trying to edit spatie tags:
Forms\Components\TextInput::make('name')
->afterStateHydrated(function (Forms\Components\TextInput $component, \Spatie\Tags\Tag $tag, Forms\Components\Livewire $livewire) {
$component->state($tag->getTranslation('name', $livewire->activeLocale));
})
This fails:
App\Filament\Resources\TagResource::App\Filament\Resources\{closure}(): Argument #3 ($livewire) must be of type Filament\Forms\Components\Livewire, App\Filament\Resources\TagResource\Pages\ManageTags given, called in /Users/xxx/xxx/xxx/xxx/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35
2 replies
Display an image (ImageColumn) from local storage (not public accessible)
hey all. I store some images on the local disk which is not accessible by the webserver, its just a file storage. Is it possible to show the images with ImageColumn in a table? Should I make a custom column and use laravel intevention plugin?
3 replies
Pseude Toggle for activating an other field
I want to use a Toggle Field. The field has no represantation in the database. I just want to use it to activate (show/hide) an other field.
The other field I activate/hide with this:
->hidden(fn (Forms\Get $get): bool => ! $get('with_uploads'))
This works.
But I cant manage it to set the toggles state on form load to the right value, it is always off.
Forms\Components\Toggle::make('with_uploads')
->default(true)
->live(),
Even when I try to use ->state()
with a Function I get the error:
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
Any suggestions?3 replies
FileUpload And Morph
I have an UploadResource which stores Uploads and some other data. In the Model it I have a method "uploadable" and I use "MorphTo". In my User Model I have "MorphMany" uploads. This works fine with a RelationManger. But now I want to use it also for other Resources which also should have Uploads but dont want to use RelationManger, just an FileUploadField. Any ideas?
8 replies
Dynamic view when using ViewEntry possible?
In an infolist I want to load a view based on "transaction->account->type". My current working solution ist this:
return $infolist
->schema([
ViewEntry::make('paypal')
->visible(function (Transaction $transaction) {
return $transaction->account->type == 'paypal';
})
->view('filament.infolists.transaction.paypal'),
ViewEntry::make('bank')
->visible(function (Transaction $transaction) {
return $transaction->account->type == 'bank';
})
->view('filament.infolists.transaction.bank'),
ViewEntry::make('cash')
->visible(function (Transaction $transaction) {
return $transaction->account->type == 'cash';
})
->view('filament.infolists.transaction.cash')
]);
is there a better way?
an other alternative may is to load the final view (paypal, bank or cash) in a base view ...1 replies
How to conditionaly use headerActions for tables?
I have my table configured seperately in an own class, so that I can use it on the main resource and in the manager. Is there a way to use table functions like headerAction or filters conditionaly? And how can I show/hidde a field/column based on where a table or form is used (main resource or manager) ?
3 replies