F
Filament6mo ago
Tieme

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
Infolists\Infolist::$defaultCurrency = $options['defaultCurrency'];
Infolists\Infolist::$defaultDateDisplayFormat = $options['defaultDateDisplayFormat'];
Infolists\Infolist::$defaultDateTimeDisplayFormat = $options['defaultDateTimeDisplayFormat'];
Infolists\Infolist::$defaultTimeDisplayFormat = $options['defaultTimeDisplayFormat'];
Infolists\Infolist::$defaultCurrency = $options['defaultCurrency'];
Infolists\Infolist::$defaultDateDisplayFormat = $options['defaultDateDisplayFormat'];
Infolists\Infolist::$defaultDateTimeDisplayFormat = $options['defaultDateTimeDisplayFormat'];
Infolists\Infolist::$defaultTimeDisplayFormat = $options['defaultTimeDisplayFormat'];
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.
Gist
FilamentLocaleOptions.php
GitHub Gist: instantly share code, notes, and snippets.
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. ...
Jump to solution
4 Replies
Tieme
Tieme6mo ago
Anyone?
awcodes
awcodes6mo ago
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
Tieme
Tieme6mo ago
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
Tieme
Tieme6mo ago
@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...
Want results from more Discord servers?
Add your server
More Posts
How can customize table row height , padding ?I try to change the row height of filament table but I do not see any thing about it in document .Rendering Modified User Form View from Vendor FileI have modified some code in the vendor file of a user resource, specifically in the "create user" fFilament app work on "http" but not on "https" on a VPS with SSLHi, my Filament app work on "http" but not on "https" on a VPS. I have configured a SSL certificate Prefilling a Field in "Create New Option" Modal of a Select Component in FilamentPHP**I want to prefill a field in the "create new option" modal, Here's the code I've tried, but it doesToggle column with confirmationCan we show confirmation modal when table toggle is changed? I want the confirmation to pop-up whenSummerise when using cents?As I am now storing values as intergers, what's the recommend approach for Summerising? Wondering ifCSRF issue on passing ZAP Security TestI go some medium Risk Level after User scan the website. I am using the "Filament Form" to do some Use Notification for error 500 in productionHello, With error handling, how do you manage to display a notification instead of the classical bigHi is it possible to add an action to a Grouped set of rows (so the button is on the group row)?Hi is it possible to add an action to a Grouped set of rows (so the button is on the group row)?How to get the value of an attribute in a repeater with relation?I have two models Year and Periods, they are related from one to many. But with the Get $get attribu