Tetracyclic
Tetracyclic
FFilament
Created by Tetracyclic on 5/23/2024 in #❓┊help
formatStateUsing on simple repeater component
Is there a reasonable way to apply formatStateUsing to the component in a simple repeater, without reimplementing the logic in the repeater to format the array with UUID keys? Applying it directly to the component fails, as formatStateUsing/afterStateHydrated are called on the child component before the repeater component is hydrated, so $state is always null. Applying it to the repeater itself requires reimplementing the logic in Repeater::afterStateHydrated to assign UUIDs to each array, which seems fragile.
27 replies
FFilament
Created by Tetracyclic on 5/22/2024 in #❓┊help
Require confirmation modal on submit action
Is it possible to trigger a confirmation modal from an action that submits a form? Adding requireConfirmation() appears to have no effect if submit() is used. The docs only mention it not working when using a url() action, but I assume the same is true with a submit() action? Reading through the source of Action, MountableAction, CanSubmitForm and CanOpenModal, I've not been able to figure out why it's not being called so far.
5 replies
FFilament
Created by Tetracyclic on 5/13/2024 in #❓┊help
Stretch grid table row so that column actions sit at the bottom
When a table is displayed as a grid using contentGrid(), if the heights of each row box differs, the footer actions will stick to the bottom of the content, rather than sitting flush with the bottom of the box. The obvious solution is to set the inner div immediately .fi-ta-record that wraps the row to flex h-full items-stretch (default is flex items-center) Is there a better way to apply these classes, than just manually targeting .fi-panel-app .fi-dashboard-page .fi-ta-record > div with height: 100%; align-items: stretch? It doesn't appear to be possible to target this container with extraAttributes.
22 replies
FFilament
Created by Tetracyclic on 5/4/2024 in #❓┊help
Elegant handling of 419 expiry
Does anyone have an elegant solution for handling a 419 expiration in Filament? By default in Laravel, the CSRF token and session expire after two hours, which is extended on every interaction. If the user leaves a page with no polling open for two hours (default expiry), or closes their browser, or puts the computer to sleep, when they return to the page they'll end up seeing a full page modal containing a 419 Expiry message, along with a JS popup saying the page has expired. When they click to refresh, even if they're logged in with a "Remember Me" token, they seem to be logged out and directed to the login page.
16 replies
FFilament
Created by Tetracyclic on 4/28/2024 in #❓┊help
Select::selectablePlaceholder(false) not working with relationships
I have the following select component, which correctly displays as a list of the user's leads, with the first item always selected:
Components\Select::make('lead_id')
->relationship('lead', 'name', fn (): Builder => Lead::query()->where('user_id', auth()->user()->id))
->selectablePlaceholder(false)
->required()
Components\Select::make('lead_id')
->relationship('lead', 'name', fn (): Builder => Lead::query()->where('user_id', auth()->user()->id))
->selectablePlaceholder(false)
->required()
If selectablePlaceholder(false) is removed, it works as expected. With it in place however, it always fails the required() validation, despite the option being selected. Removing required() allows the form to be saved, but the lead_id value is never persisted to the database.
5 replies
FFilament
Created by Tetracyclic on 2/21/2024 in #❓┊help
defaultGroup set to attribute from parent relationship fractures group
Hi all, I have a Category model with a parent_id that can reference another category. This is only used for categories with a single level of subcategories below them. If I set defaultGroup('parent_id') it works as I'd expect, with the top level categories ungrouped at the top, followed by a group for each. However if I set defaultGroup('parent.title') the groups repeat themselves with only a couple of items under each level. There's no clear pattern to why they're grouped up separately, and in some cases it skips over a group until the next "cycle" Expected:
- Top Cat One
- Top Cat Two
- Top Cat Three
*Top Cat One*
- Sub cat one
- Sub cat two
- Sub cat three
*Top Cat Two*
- Sub cat four
- Sub cat five
- Sub cat six
*Top Cat Three*
- Sub cat seven
- Sub cat eight
- Sub cat nine
- Top Cat One
- Top Cat Two
- Top Cat Three
*Top Cat One*
- Sub cat one
- Sub cat two
- Sub cat three
*Top Cat Two*
- Sub cat four
- Sub cat five
- Sub cat six
*Top Cat Three*
- Sub cat seven
- Sub cat eight
- Sub cat nine
Actual:
- Top Cat One
- Top Cat Two
- Top Cat Three
*Top Cat One*
- Sub cat one
*Top Cat Two*
- Sub cat four
- Sub cat five
*Top Cat Three*
- Sub cat seven
*Top Cat One*
- Sub cat two
- Sub cat three
*Top Cat Three*
- Sub cat eight
- Sub cat nine
*Top Cat One*
- Sub cat three
*Top Cat Two*
- Sub cat six
- Top Cat One
- Top Cat Two
- Top Cat Three
*Top Cat One*
- Sub cat one
*Top Cat Two*
- Sub cat four
- Sub cat five
*Top Cat Three*
- Sub cat seven
*Top Cat One*
- Sub cat two
- Sub cat three
*Top Cat Three*
- Sub cat eight
- Sub cat nine
*Top Cat One*
- Sub cat three
*Top Cat Two*
- Sub cat six
12 replies