jelmerkeij
Spatie Translatable plugin: Possible to have persistent LocaleSwitcher?
Is it possible to have the LocaleSwitcher be persistent when navigating through List and Edit ResourcePages? So for example whenthe user selects the language "Spanish" it keeps it in the session or wherever and when reloading the page or navigating to another resource page that has the LocaleSwitcher it's still in Spanish instead of being reloaded to the first language (English) defined in:
2 replies
FileUpload: Uploading (large files) directly to S3
Again I'm struggling with uploading of large files (several gigabytes). I am experimenting with using the S3 (in my case, DigitalOcean) as the filesystem. This in the hopes of having the FileUpload component set up to upload directly to the server when selecting a file instead of sending it to a temp directory on the webserver first and avoiding "File too large" errors. But I cannot figure out how to do this. Is this even possible? Can anybody please point me in the right direction of example?
8 replies
Custom Field does not submit data
Created a custom field as in the docs, using
artisan make:form-field ProductPrices
. The component looks like this and receives an array of Currency
models:
And I use it in my form as:
The view of my custom component is:
And an input field is indeed generated for every currency: <div><input wire:model="data.pricesTest.1"></div>
In EditProduct extends EditRecord
, where I use the ProductResource
with said form I do a dd()
:
Other values of 'default' Filament form fields are there but I cannot figure out why my custom field PricesTest
isn't submitted into the form data. Can someone please point me where I'm going wrong?11 replies
Select list: How to handle soft deleted (trashed) relations?
In my form for a QuoteResource I have a Repeater with in there a Selectlist that uses a relation to select a product:
Now say the product get soft deleted in the meantime. If I go back to editing my quote in which this product was previously selected the selectlist now shows up empty because the product is of course deleted. I expect it to be still filled with the trashed product, but when trying to select a different product it should not show up available for selection.
I've tried adding
modifyQueryUsing: fn( Builder $query ) => $query->withTrashed()
to the relationship
parameters but this makes deleted products available for selection when adding a new item as well.
Can anybody point me to how to handle this kind of situation?2 replies
How to add extraAttributes (class) to Section container?
My form schema looks like this:
The output on the frontend is below (excerpt from the section). Now I want to add an extra CSS class to the column that contains the last section. Is that possible, and if so - how?
4 replies
`mutateFormDataUsing()` not working on CreateAction?
In an Example app with Filament 3.0.7 I've setup a 'Tester' model with just 1 attribute -
$name
:
And generated a TestersResource
for it. Now on the ListTesters::getHeaderActions()
I'm trying to override the name on save:
The value is then not set in the model when saving. Am I doing something wrong?
However setting the same mutateFormUsing
on the EditAction
does indeed work and set the model's $name
attribute value to Overridden name
.4 replies
Livewire component has 'undefined variable' after updating Livewire?
I've setup a FormField as Livewire component in the a testing app using Filament 3 and Livewire 3:
Component:
View:
Now where it says 'value is' it correctly echoed the value of my
$testVar
, but after updating via Composer it now throws an error Undefined variable $testVar
Is there any way to mitigate this?
Composer:
6 replies
Set column action on condition
I have a table of products. Now if the product is of type 'bundled product' I want to bind an action that when clicked on the product name (the
TextColumn
) a modal opens displaying the contents of the product bundle.
But if the product is not of type 'bundled' then you shouldn't be able to click the product name since there are no bundled products to display in the modal. So the action should not be attached in that case.
I've tried visible
, hidden()
on the action but they don't seem to work. Not when using a closure and not when passing in a hardcoded true
of false
value. The product name is always clickable and the action is executed.
Is it even possible to have the action conditionally set? How would I do that?
Thanks for any help and pointers.18 replies
Can afterStateHydrated know if new record or editing?
When using the
afterStateHydrated
on a select field in a form, can you know if it's in the modal for creating a new record or updating an existing one?
I only want to set the pre-selected value of parent_id
when creating a new record through the 'simple' resource manager but not when editing an existing record so the value of an existing records parent_id doesn't accidentally change.
4 replies