Gaspar
Gaspar
FFilament
Created by Gaspar on 10/5/2024 in #❓┊help
decimal value has inconsistencies/bugs in Column and Textinput
Bumped to very weird Filament "bug" today. Did some research in docs, Git, and here and found nothing. 1. have field price in database (MySQL): price` double(20,4) 2. have value in this field: 5.9400 3. Filament Table (Tables\Columns\TextColumn::make('price')) shows: 5.94 (should be 5.9400) 4. Filament Form (Components\TextInput::make('price')) shows: 5.9399999999999995 (should be 5.9400) I very much prefer Filament not changing values stored in database 🙂 Any ideas what is going on and can i "fix" it?
5 replies
FFilament
Created by Gaspar on 8/13/2024 in #❓┊help
How can i catch Filament Import Action errors
I'm using Filament Import Action https://filamentphp.com/docs/3.x/actions/prebuilt-actions/import There is a table called failed_import_rows and it has row data and field validation_error. But there are no validation errors so i have no glue why are some rows not imported. How can i catch/save errors occuring in row import?
3 replies
FFilament
Created by Gaspar on 8/1/2024 in #❓┊help
enum value in Forms\Components\Select
My enum labels shows both as Select element value and label. Using Filament docs example here as a base.
enum Status: string implements HasLabel
{
case DRAFT = 'My draft label';
public function getLabel(): ?string
{
return $this->name;
}
}
enum Status: string implements HasLabel
{
case DRAFT = 'My draft label';
public function getLabel(): ?string
{
return $this->name;
}
}
Select::make('status')
->options(Status::class)
Select::make('status')
->options(Status::class)
It produces:
<option value="My draft label">My draft label</option>
<option value="My draft label">My draft label</option>
I'd like to have:
<option value="DRAFT">My draft label</option>
<option value="DRAFT">My draft label</option>
How to "fix" this?
8 replies
FFilament
Created by Gaspar on 7/31/2024 in #❓┊help
Custom theme - Tailwind class not included in built css
Made custom theme and required steps but my added Tailwind class is not in CSS. For testing i added Tailwind class text-ellipsis to app/Filament/Resources/ProductResource.php
Placeholder::make('documentation')
->content(new HtmlString('<a href="https://filamentphp.com/docs" class="text-ellipsis">filamentphp.com</a>'))
Placeholder::make('documentation')
->content(new HtmlString('<a href="https://filamentphp.com/docs" class="text-ellipsis">filamentphp.com</a>'))
1. Made custom theme:
php artisan make:filament-theme --pm=bun
Using bun v1.1.4
INFO Filament theme [resources/css/filament/admin/theme.css] and [resources/css/filament/admin/tailwind.config.js] created successfully.
INFO Filament theme [postcss.config.js] created successfully.
WARN Action is required to complete the theme setup:
⇂ First, add a new item to the `input` array of `vite.config.js`: `resources/css/filament/admin/theme.css`
⇂ Next, register the theme in the admin panel provider using `->viteTheme('resources/css/filament/admin/theme.css')`
php artisan make:filament-theme --pm=bun
Using bun v1.1.4
INFO Filament theme [resources/css/filament/admin/theme.css] and [resources/css/filament/admin/tailwind.config.js] created successfully.
INFO Filament theme [postcss.config.js] created successfully.
WARN Action is required to complete the theme setup:
⇂ First, add a new item to the `input` array of `vite.config.js`: `resources/css/filament/admin/theme.css`
⇂ Next, register the theme in the admin panel provider using `->viteTheme('resources/css/filament/admin/theme.css')`
2. Added new item in vite.config.js
input: ['resources/css/app.css', 'resources/js/app.js', 'resources/css/filament/admin/theme.css'],
input: ['resources/css/app.css', 'resources/js/app.js', 'resources/css/filament/admin/theme.css'],
3. Added viteTheme() to Admin-panel
->viteTheme('resources/css/filament/admin/theme.css');
->viteTheme('resources/css/filament/admin/theme.css');
4. Executed build command
bun run build
$ vite build
vite v5.3.5 building for production...
transforming (1) resources/js/app.js
warn - The `content` option in your Tailwind CSS configuration is missing or empty.
warn - Configure your content sources or your generated CSS will be missing styles.
bun run build
$ vite build
vite v5.3.5 building for production...
transforming (1) resources/js/app.js
warn - The `content` option in your Tailwind CSS configuration is missing or empty.
warn - Configure your content sources or your generated CSS will be missing styles.
Why the tailwind.config.js warning here? The Filament command created this file @ resources/css/filament/admin/tailwind.config.js:
import preset from '../../../../vendor/filament/filament/tailwind.config.preset'

export default {
presets: [preset],
content: [
'./app/Filament/**/*.php',
'./resources/views/filament/**/*.blade.php',
'./vendor/filament/**/*.blade.php',
],
}
import preset from '../../../../vendor/filament/filament/tailwind.config.preset'

export default {
presets: [preset],
content: [
'./app/Filament/**/*.php',
'./resources/views/filament/**/*.blade.php',
'./vendor/filament/**/*.blade.php',
],
}
Am i missing something here?
5 replies
FFilament
Created by Gaspar on 1/4/2024 in #❓┊help
How to translate label "updated_at"?
Tables\Columns\TextColumn::make('updated_at')->translateLabel()
Tables\Columns\TextColumn::make('updated_at')->translateLabel()
My language json has:
"Updated at": "My translation..",
"Updated at": "My translation..",
This solution doesn't work - my label remains untranslated ("Updated at"). Other translations work.
8 replies
FFilament
Created by Gaspar on 12/28/2023 in #❓┊help
Hide table columns sorting ability then Grouping
If using Grouping then table sorting is not working. Only Grouping sorting. It is kind of bug 😦 To overcome this i would like to hide columns sorting ability then Grouping. Is there any get method for quering table Grouping?
2 replies
FFilament
Created by Gaspar on 12/27/2023 in #❓┊help
how to add Tailwind classes using extraInputAttributes()
For example
Tables\Columns\TextInputColumn::make('example')
->extraInputAttributes(['class' => 'max-w-32'])
Tables\Columns\TextInputColumn::make('example')
->extraInputAttributes(['class' => 'max-w-32'])
This max-w-32 class is not added to css files.. What is the best approach to add Tailwind classes to Filament components?
2 replies
FFilament
Created by Gaspar on 11/30/2023 in #❓┊help
change Infolists\Components\TextEntry content class
Currently the TextEntry component has child element with class:
<div class="fi-in-text-item inline-flex items-center gap-1.5 ">
<div class="fi-in-text-item inline-flex items-center gap-1.5 ">
This changes all elements into inline elements. I would like to avoid that and change the classname
inline-flex
inline-flex
into
flex-1
flex-1
to display content in full width! Is it possible to "override" it or should i make my own component?
7 replies
FFilament
Created by Gaspar on 11/26/2023 in #❓┊help
how to scope count in multi-tenancy?
I use tenant in my panel. It scopes records by user. Logic is in ApplyTenantScopes::class. And it works correctly. However is also use count() in Resource getNavigationBadge():
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
That is not scoped anymore (it counts all records). How to resolve this? Should i put double logic in my Model also? Or i can use ApplyTenantScopes::class (logic) in here somehow?
2 replies
FFilament
Created by Gaspar on 11/25/2023 in #❓┊help
Theme switcher do not save state in local storage
I have (default) theme light/dark/system switcher in user menu. But it does not save the state in local storage. Should it (is something wrong with my installation)?
6 replies
FFilament
Created by Gaspar on 10/21/2023 in #❓┊help
Table builder > Tailwind CSS > darkMode: 'class' not working
Installed Tailwind CSS based on this: https://filamentphp.com/docs/3.x/tables/installation#installing-tailwind-css In the tailwind.config.preset there is darkMode "mode" defined:
export default {
darkMode: 'class',
...
}
export default {
darkMode: 'class',
...
}
Basically it means i can control dark/lightMode with classname. But it doesn't work 😦 My Filament Table has still MEDIA query attached:
@media (prefers-color-scheme: dark) {
.dark\:bg-gray-900 {
--tw-bg-opacity: 1;
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
}
@media (prefers-color-scheme: dark) {
.dark\:bg-gray-900 {
--tw-bg-opacity: 1;
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
}
How do you resolve it?
1 replies
FFilament
Created by Gaspar on 10/20/2023 in #❓┊help
Upgrading from v2 > v3 throws "Fatal error"
laravel/framework v10.28.0
filament/filament v2.17.53
filament/forms v2.17.53
filament/notifications v2.17.53
filament/support v2.17.53
filament/tables v2.17.53
filament/upgrade v3.0.81
nunomaduro/collision v7.10.0
nunomaduro/termwind v1.15.1
laravel/framework v10.28.0
filament/filament v2.17.53
filament/forms v2.17.53
filament/notifications v2.17.53
filament/support v2.17.53
filament/tables v2.17.53
filament/upgrade v3.0.81
nunomaduro/collision v7.10.0
nunomaduro/termwind v1.15.1
run the script:
vendor/bin/filament-v3

Filament v3 Upgrade


Welcome to the Filament v3 upgrade process!
... (redacted ) ..

Are you ready to continue? y/n
Fatal error: Uncaught Symfony\Component\Console\Exception\MissingInputException: Aborted. in /app/vendor/symfony/console/Helper/QuestionHelper.php:139
Stack trace:
#0 /app/vendor/symfony/console/Helper/QuestionHelper.php(68): Symfony\Component\Console\Helper\QuestionHelper->doAsk(Object(Symfony\Component\Console\Output\StreamOutput), Object(Symfony\Component\Console\Question\Question))
#1 /app/vendor/nunomaduro/termwind/src/Question.php(87): Symfony\Component\Console\Helper\QuestionHelper->ask(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\StreamOutput), Object(Symfony\Component\Console\Question\Question))
#2 /app/vendor/nunomaduro/termwind/src/Functions.php(63): Termwind\Question->ask(Object(Symfony\Component\Console\Question\Question), NULL)
#3 /app/vendor/filament/upgrade/bin/filament-v3(46): Termwind\ask(' <span class...')
#4 /app/vendor/bin/filament-v3(119): include('/app/vendor/fil...')
#5 {main}
thrown in /app/vendor/symfony/console/Helper/QuestionHelper.php on line 139
vendor/bin/filament-v3

Filament v3 Upgrade


Welcome to the Filament v3 upgrade process!
... (redacted ) ..

Are you ready to continue? y/n
Fatal error: Uncaught Symfony\Component\Console\Exception\MissingInputException: Aborted. in /app/vendor/symfony/console/Helper/QuestionHelper.php:139
Stack trace:
#0 /app/vendor/symfony/console/Helper/QuestionHelper.php(68): Symfony\Component\Console\Helper\QuestionHelper->doAsk(Object(Symfony\Component\Console\Output\StreamOutput), Object(Symfony\Component\Console\Question\Question))
#1 /app/vendor/nunomaduro/termwind/src/Question.php(87): Symfony\Component\Console\Helper\QuestionHelper->ask(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\StreamOutput), Object(Symfony\Component\Console\Question\Question))
#2 /app/vendor/nunomaduro/termwind/src/Functions.php(63): Termwind\Question->ask(Object(Symfony\Component\Console\Question\Question), NULL)
#3 /app/vendor/filament/upgrade/bin/filament-v3(46): Termwind\ask(' <span class...')
#4 /app/vendor/bin/filament-v3(119): include('/app/vendor/fil...')
#5 {main}
thrown in /app/vendor/symfony/console/Helper/QuestionHelper.php on line 139
I can not even answer the question "Are you ready to continue?". It throws immediately "MissingInputException". Any idea what's wrong with Filament upgrade script?
6 replies
FFilament
Created by Gaspar on 10/14/2023 in #❓┊help
How to translate "All" in filter
No description
15 replies
FFilament
Created by Gaspar on 9/30/2023 in #❓┊help
Reordable pivot table in Relation Manager
I have 3 tables: * categories (id, name) * attributes (id, name) * attribute_category (category_id, attribute_id, order) - pivot table I have AttributesRelationManager in Category Edit page:
class AttributesRelationManager extends RelationManager
{
...
protected static string $relationship = 'attributes';
...
public function table(Table $table): Table
{
return $table->..
->columns([
Tables\Columns\TextColumn::make('order'),
Tables\Columns\TextColumn::make('name'),
])
->reorderable('order');
}
...
}
class AttributesRelationManager extends RelationManager
{
...
protected static string $relationship = 'attributes';
...
public function table(Table $table): Table
{
return $table->..
->columns([
Tables\Columns\TextColumn::make('order'),
Tables\Columns\TextColumn::make('name'),
])
->reorderable('order');
}
...
}
It shows category attributes nicely, ordered by order field in attribute_category But then i try to reorder those displayed attributes, it generates DB error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order' in 'field list'

update
`attributes`
SET
`ORDER` = CASE
...
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'order' in 'field list'

update
`attributes`
SET
`ORDER` = CASE
...
What am i missing here?
2 replies
FFilament
Created by Gaspar on 8/16/2023 in #❓┊help
How to show FilamentIcon inside Placeholder
This example selects correct "icon class" (instead of icon itself). I would like to show FilamentIcon instead.
Placeholder::make('boolean')
->content(fn (string $state): string => match ($state) {
'1' => 'heroicon-o-check',
default => 'heroicon-x-circle'
}
)
Placeholder::make('boolean')
->content(fn (string $state): string => match ($state) {
'1' => 'heroicon-o-check',
default => 'heroicon-x-circle'
}
)
Could not find example how to do it: https://filamentphp.com/docs/3.x/support/icons
4 replies
FFilament
Created by Gaspar on 8/7/2023 in #❓┊help
SelectFilter - can i provide my own value + label / remove the default option
SelectFilter always populates option without value and default label "All": <option>All</option> How can i provide my own value and label for it? Or second option - remove it altogether?
6 replies
FFilament
Created by Gaspar on 8/5/2023 in #❓┊help
Use LocaleSwitcher in userMenuItems
I have multilanguage content. Currently i loop over all my allowed locales and display standard links in userMenuItems. It gets pretty long (not the best UI/UX experience). I would like to use SpatieLaravelTranslatablePlugin widget (Livewire) LocaleSwitcher in AdminPanel userMenuItems to switch app locale rather to put this Widget in every Resource page and duplicate code. There is Theme Switcher working in user menu already. Is it doable to inject other Livewire widgets?
2 replies
FFilament
Created by Gaspar on 7/6/2023 in #❓┊help
Best way to format data in the table
1. data is stored in DB, for example: 0.40 (as money) and quantity 1234.56 (as float) 2. i would like to display localized data, for example: €0,40 (as money in EUR) and quantity 1 234.56 (as set in selected locale) I made a test for money column: Tables\Columns\TextColumn::make('price')->money('eur') But this displays incorrect value as "€4,00" (it should be €0,40). Q1: What's wrong here? And i see no ->number() type (as in Filament Form component). Q2: What is the best way to do it in Filament Table component? Should i customise every column with my own implementation ->formatStateUsing()?
29 replies
FFilament
Created by Gaspar on 6/15/2023 in #❓┊help
Changing the maximum content width is not working?
According to docs i should be able to change content maximum width, right?! Tried both. 1. in config/filament.phpi entered
'layout' => [
'max_content_width' => 'full',
],
'layout' => [
'max_content_width' => 'full',
],
My resource page html still contains max-w-7xl 2. in my resource page i entered protected ?string $maxContentWidth = 'full'; My resource page html still contains max-w-7xl What i'm missing here?
12 replies
FFilament
Created by Gaspar on 6/13/2023 in #❓┊help
How to format dependable, readonly(calculated) fields?
I have a form with 3 TextInput fields: * amount (user enters value here) * price (comes from db) * sum (calculated field/value)
Forms\Components\TextInput::make('amount')
->numeric()
->reactive()
->afterStateUpdated(function (callable $set, callable $get, $state) {
$this->calculate($set, $get);
})
->required(),
Forms\Components\TextInput::make('price')
->extraInputAttributes(['readonly' => true]),
Forms\Components\TextInput::make('sum')
->extraInputAttributes(['readonly' => true]),
Forms\Components\TextInput::make('amount')
->numeric()
->reactive()
->afterStateUpdated(function (callable $set, callable $get, $state) {
$this->calculate($set, $get);
})
->required(),
Forms\Components\TextInput::make('price')
->extraInputAttributes(['readonly' => true]),
Forms\Components\TextInput::make('sum')
->extraInputAttributes(['readonly' => true]),
I can use Mask for amount field but how can i format read-only fields price and sum?
5 replies