static values Table / Infolist/ DateTimePicker based on locale
Hi All,
There are some static values in the Table / Infolist/ DateTimePicker class.
If i set them in AppServiceProvider the values change with my options.
Example settings
I want to change these values based on current locale from user.
I use this plugin to add local to dashboard.
https://filamentphp.com/plugins/bezhansalleh-language-switch
I created a Middleware to set these settings.
In the Middleware i have the correct locale.
Now the problem is that these values are not set, and only the default in the classes are set.
This is my complete Middleware : https://gist.github.com/sitenzo/4b357ab20284e1bf79bd3e5eef994036
How can i set these values based on locale?
Thanks
Filament
Language Switch by Bezhan Salleh - Filament
Zero config Language Switcher plugin for Filament Panels.
Solution:Jump to solution
I now know what the problem is.
In my AppServiceProvider is set some settings for table but not locale because it is always the local of the app and not user.
the static settings for table is set in a Middleware.
...
4 Replies
Anyone?
Setting them like that won’t work.
Follow https://filamentphp.com/docs/3.x/forms/fields/getting-started#global-settings
And in the callbacks you can get the locale with app()->getLocale() to see what it is and configure the fields appropriately.
Solution
I now know what the problem is.
In my AppServiceProvider is set some settings for table but not locale because it is always the local of the app and not user.
the static settings for table is set in a Middleware.
i cant configure the table twice, than it will use the AppServiceProvider and not the Middleware.
To get this working i need to set all table settings in the Middleware
@awcodes I created a issue, it is not working as expected in documentation
https://github.com/filamentphp/filament/issues/10459
GitHub
Global Settings in Middelware not working correctly · Issue #10459 ...
Package filament/filament Package Version 3.1.27 Laravel Version 10.38.2 Livewire Version No response PHP Version 8.1.6 Problem description In my project i use different locales, there are some sta...