Shavik
Table Summary Color
I would like to set the color of a table summary.
I searched the docs and discord but couldn't find anything about it.
Example: If the summary (total) is above 100%, I'd like the summary to be red.
Anyone done something like this?
3 replies
PHP Enum "Inheritance " in Filament
First off, I know you can't extend an enum in PHP, I'm trying to figure a way to accomplush that functionality though for the Filament
getLabel
, etc methods.
Lets say I have a base "Laravel" package that has among other things, an enum.
It's a plain 'ol, string backed enum. Nothing fancy.
If I then have a Filament plugin (package) that wants to use that enum, PHP lacking enum inheritance strikes again.
Does anyone have any preferred 'tricks' for 'extending (but not really)' an enum in this Filament package so that it has the getLabel
, getColor
, etc methods?
For example, the base Laravel package would have no Filament dependencies.
It could have an enum like
and in the Filament plugin that uses it, I'd like to have some way to 'add' the getLabel, etc to it.
In a dream world:
Been scratching my head at a clean way to solve this for a day or two. Just didn't know if anyone else had encountered this or knew of a good way to handle it. Thanks!8 replies
Table Summarizer Bug on PostgreSQL
So I have a table column defined as such:
I had asked yesterday how do to this price * quantity calculation but I was getting this error:
SQLSTATE[42601]: Syntax error: 7 ERROR: zero-length delimited identifier at or near """"
The query that is generated is
Clearly it's the last line ) AS ""
. I dug into the Summarizer.php
file on line 108.
$query = DB::table($query->toBase());
I haven't really looked at the source code for any of the Filament query stuff before it I changed the line to
$query = DB::table($query->toBase(), 'test');
The above code now works. I'm not saying the table alias needs to be 'test' but I just needed a name to try. I'm not really sure what the best practice (naming) for this would be but I might also cross post this as a GitHub issue.
Just wasn't sure if there was something else on the 'user' side (me, the dev) that I need to do to get this working? (since it also seems like a postgres quirk)36 replies
->fillForm is very slow in tests
I'm working on writing some feature/integration tests a simple Filament App.
It tracks 'people'. I have the following test that should test that a user can be created.
My problem is the
->fillForm
method is very slow. It takes around 20 seconds to run.
This code look scarier than it should as I've broken many things down to time them.
The output is the following:
As you can see, there are no slow queries and I've isolated the slowness to the ->fillForm
method. I can't see to figure out why that would be slowing things down to badly.
Any help would be greatly appreciated!28 replies
Login Page Blade Override
I'm looking for the proper way to override the default login blade?
I'm attempting to get the v3 Filament Socialite package up and running and it's instructions are a bit out of date.
It says publish the views and update the login but for one, the v3 docs recommend not publishing all view and even when I tried that, the login.blade.php isn't one of the ones generated.
I copied that blade from the vendor directory into my project but I'm unsure of how to properly configure Filament to use that new login blade.
Thanks!
16 replies
Date/Time Picker Required
When adding a DatePicker or DateTime Picker to a form (a form on a Livewire component), the
->required()
option isn't ensuring the field is filled out.
The user can still submit the form and null
is submitted on the back end.
Having a similar but worse issue with the Flatpickr plugin (which is why we went back tothe base component) where it always submits null no matter if you pick a date/time or not.
Thanks for any insight!21 replies
NavigationGroup & Page Order
I've had good luck sorting my navigation items as well as grouping some and ordering the groups.
My problem is that the pages all come before the groups, no matter the sort order.
Will I need to do a completely custom navigation to accomplish this?
3 replies
TailwindCSS in Livewire components used in Filament Pages
I have added a custom Livewire component that I'm using in a Filament page.
It's working well but I can't seem to get any of my tailwindd classes to do anything. I have installed tailwind and set it up according to the docks.
In the rendered code I see my tailwind class but it doesn't appear that it knows what it is. Is there anything else I need to do to get things working?
Not sure if this is a Filament or a Livewire issue or something else entirely. New to both.
Thanks for any help!
64 replies
Markdown Preview
Per the docs here, https://filamentphp.com/docs/3.x/forms/fields/markdown-editor
It states:
I can't seem to find anyway to enable the 'preview' that it's talking about.
Is that not talking about 'live preview' of sorts?
8 replies
Unexpected Behavior from mutateFormDataBeforeCreate
Working on a little test learning Filament project.
It is an issue tracker. I have made an Issue model/resource, etc.
The issue has a user_id that is the user that created the issue.
I have the select box working on the resource that shows the users in the dropdown, etc. That works great.
I was trying to implement it so that if a user isn't selected, it will just pick the currently logged in user when saving.
I searched discord here and found an old post where they linked to the website and it mentioned adding
to the
CreateIssue.php
I added the if empty in hopes that it would only set the user if not given from the form.
It appears that it does create the issue without problem AND that it sets the user_id so that part looks good.
The issue is that sometime after the model actually saves and the 'save' succeeding from the perspective of the frontend, I get this:
I'm not sure why it would be trying to update the record that it just saved other than perhaps trying to set the updated_at
time? But in that case, why is the user_id null?
Perhaps it has old (submitted) data for the issue (before the mutate call)?4 replies