pelmer
pelmer
FFilament
Created by pelmer on 9/3/2024 in #❓┊help
Wrong foregin key in AssociateAction
I have a RelationManager with an AssociateAction, but it doesn't work because it tries to change the wrong foregin key on the related model. THe relationship works as it should and items are listed in the RelationManager. The problem is that the AssociateAction uses a pluralised foregin key when it should be use a singular, for example posts_id instead of post_id. I have even tried specifing the foregin key in the relation on the model, but that did not help. I have verified that there is nothing wrong with the relation setup between the models and the convention is FK with singular name.
6 replies
FFilament
Created by pelmer on 3/17/2024 in #❓┊help
Actions: Is there a way to receive the results and display it?
As the title say, is there a good/simple way to pass a message back from the executed action and display it for the user? In my specific case it is header actions in a section in an infolist, but a general solution would be better. I know you can probably hook into the livewire components to make this work, but that seems like a hacky and hard to maintain solution for a problem that should be pretty common. I'm also not so proficient in how Livewire works under the hood. I also know about notifications, but that does not a great solution for more advanced or important output. I think I would prefer to show the result inline, but a modal would be fine as well. Bonus question: Is there a way to show progress while the action is executed (not so important, but would be nice). Can someone offer some guidance about this? Thank you for reading to the end! 🙂
5 replies
FFilament
Created by pelmer on 2/27/2024 in #❓┊help
Can you use StatsOverviewWidget in infolist?
Can you use StatsOverviewWidget in infolist? I managed to render it on my infolist, but how do I get the current model/record to pull out the stats for that model? Is there a way to display a bar chart with the StatsOverviewWidget?
13 replies
FFilament
Created by pelmer on 1/5/2024 in #❓┊help
Is there a way to properly test custom fields? (FormInputs, Columns, Entries)
I'm trying to write a test for my fields, but I am struggling. This is my current attempt to test an entry: https://github.com/pelmered/filament-money-field/blob/main/tests/MoneyEntryTest.php This is the Entry that I am trying to test: https://github.com/pelmered/filament-money-field/blob/main/src/Infolists/Components/MoneyEntry.php As you probably can see, I want to test that the state is formatted correctly. Can I please have some guidance here?
2 replies
FFilament
Created by pelmer on 1/3/2024 in #❓┊help
Is there a way to set the defaults on Tables and InfoLists?
Is there a way to set these static properties on Tables and InfoLists without overriding the classes? It looks like they are used directly and not though getters or similar. I would like to do it globally based on user preference with for example configureUsing.
public static string $defaultCurrency = 'usd';

public static string $defaultDateDisplayFormat = 'M j, Y';

public static string $defaultDateTimeDisplayFormat = 'M j, Y H:i:s';

public static string $defaultTimeDisplayFormat = 'H:i:s';
public static string $defaultCurrency = 'usd';

public static string $defaultDateDisplayFormat = 'M j, Y';

public static string $defaultDateTimeDisplayFormat = 'M j, Y H:i:s';

public static string $defaultTimeDisplayFormat = 'H:i:s';
2 replies
FFilament
Created by pelmer on 1/2/2024 in #❓┊help
Turn formatStateUsing into a custom entry
I need the same formatStateUsing on many places across my admin panel so I was thinking that I should create a custom Entry / Input instead. I don't get how I should trigger the formatter in my custom entry. How would a simple entry look like with a custom formatter? Or are there any better solutions for this?
10 replies