binaryfire
binaryfire
FFilament
Created by binaryfire on 11/10/2024 in #❓┊help
Open builder block picker in modal instead of dropdown
Hi I'd like to use a modal for my builder field's block picker (instead of a dropdown). Does anyone know if that's possible? Thanks!
6 replies
FFilament
Created by binaryfire on 10/30/2024 in #❓┊help
Make entire builder preview click-and-draggable
No description
4 replies
FFilament
Created by binaryfire on 5/18/2024 in #❓┊help
Optimizing / compressing image uploads before saving to disk (no media library)
Hi all I’ve got several optimisations I want to apply to images uploaded via the upload field before they’re saved to storage. I don’t need help with the optimisations themselves. What I need to figure out is how to apply things to the uploaded file before it’s saved from Livewire’s temporary storage to my S3 disk. Any ideas? I’m not using any media library plugins so I need to work with the files directly.
7 replies
FFilament
Created by binaryfire on 5/17/2024 in #❓┊help
Autosave entire edit form with debounce
Hi all Has anyone implemented autosaving for an entire edit page's form, along with some kind of debounce? I'll need to use debounce to avoid blowing up my server. Honestly have no idea on the approach to take for this one... Would I have to set live, debounce and use afterStateUpdated on every field of the form? Or is there a cleaner way? Also not really sure of the best way to save the current form state to the record using afterStateUpdated Any help or suggestions would be appreciated. Thanks!
31 replies
FFilament
Created by binaryfire on 5/6/2024 in #❓┊help
Builder field - JS to collapse all other blocks groups when a different block is clicked
Hi all I have a project with a builder field and I need to automatically expand a block's fields when a block is clicked, as well as collapse all other open blocks at the same time. The idea is that only one block should ever be expanded at a time and I need to do that without the user clicking any "collapse" / "expand" buttons. It needs to happen automatically when a closed block is clicked. Does anyone know how I could do that? I'm assuming with a little Alpine magic.
5 replies
FFilament
Created by binaryfire on 4/21/2024 in #❓┊help
Using $get to get the state of parent form fields in repeaters
Hi all Is there a way of getting the state of a parent form field in a closure in a repeater field? Eg this doesn't work:
TextInput::make('title')
->live(),

Repeater::make('members')
->schema([
TextInput::make('test')
->label(function (Get $get) {
return $get('title');
})
])
TextInput::make('title')
->live(),

Repeater::make('members')
->schema([
TextInput::make('test')
->label(function (Get $get) {
return $get('title');
})
])
9 replies
FFilament
Created by binaryfire on 4/14/2024 in #❓┊help
Table `recordAction()` with redirect
Hi all. When a table row is clicked, I need to run some code to generate a URL then redirect to it. It's a SSO link so it has to be generated on click (so I can't use recordUrl). Does anyone know how I could do this? I've played around with recordAction but haven't been able to find a working solution.
5 replies
FFilament
Created by binaryfire on 4/9/2024 in #❓┊help
Make clicking on a table row open the ViewAction modal
Hi all I've got a resource without a create, edit or view page. There's just a List page with a table row ViewAction, which opens in a modal. How can I make clicking on the table row open the ViewAction modal?
2 replies
FFilament
Created by binaryfire on 4/9/2024 in #❓┊help
Fill modal infolist from array
Hi all. I'm using a Table row action to display data from another record in a modal. With forms, I can use an action's ->fillForm() method to populate the modal's ->form(). Is there a way to do the same for a modal's ->infolist()?
6 replies
FFilament
Created by binaryfire on 4/6/2024 in #❓┊help
Refresh page on broadcast event
Hi all. Does anyone know how I could use a broadcast event (websockets) to trigger a Filament page refresh?
4 replies
FFilament
Created by binaryfire on 4/1/2024 in #❓┊help
Using an enum with a toggle
Does anyone know of a clean way to use enums with toggles? One of my models has a status column with only 2 values - active and inactive. I want the toggle to switch between these values. I'd prefer to use an enum vs a boolean because I want to display the status using a badge (with labels, icons and colors).
25 replies
FFilament
Created by binaryfire on 3/31/2024 in #❓┊help
Add icon to relation manager tabs
Hi all. Is there a way to add an icon (not a badge) to relation manager tabs?
5 replies
FFilament
Created by binaryfire on 3/24/2024 in #❓┊help
Exclude a page from global panel middleware
Hi all. Is there a way of excluding a page from the global panel middleware? Use case: I need to prevent access to a panel until a user has verified their billing information. I've added my RedirectIfBillingNotVerified middleware to ->authMiddleware() and it works, but the page with the billing verification form needs to be excluded. I could create a separate (non-panel) page but I'd prefer it to be a panel page so it inherits the panel styling. Is there a simple way of doing this?
5 replies
FFilament
Created by binaryfire on 3/19/2024 in #❓┊help
Accessing related $record(s) in hasMany repeaters
Hi all I have a repeater that uses a hasMany relationship (via a pivot model). I need to access each item's record inside the header action closures. Any idea how I can do that? Thanks!
11 replies
FFilament
Created by binaryfire on 3/14/2024 in #❓┊help
Disable topbar on an individual custom page
Hi. I'm rolling my own two factor auth and have created a custom SimplePage page for entering the code. It's all working, but the database notifications trigger and profile dropdown are showing. I can't hide them with CSS since that isn't secure. Is there any way to disable them on a specific page?
2 replies
FFilament
Created by binaryfire on 3/13/2024 in #❓┊help
Can't get extraModalFooterActions to work
Hi. I can't seem to get ->extraModalFooterActions working. When I use Filament\Forms\Components\Actions\Action I get an Typed property Filament\Forms\Components\Actions\Action::$component must not be accessed before initialization exception:
{
return $form
->schema([
TextInput::make('test_input')
->required(),

Actions::make([
Action::make('test')
->action(function () {
//
})
->modal()
->modalHeading('Test')
->extraModalFooterActions([
\Filament\Forms\Components\Actions::make('extraActionTest')
->requiresConfirmation()
->action(function () {
dd('test');
}),
])
])

]);
}
{
return $form
->schema([
TextInput::make('test_input')
->required(),

Actions::make([
Action::make('test')
->action(function () {
//
})
->modal()
->modalHeading('Test')
->extraModalFooterActions([
\Filament\Forms\Components\Actions::make('extraActionTest')
->requiresConfirmation()
->action(function () {
dd('test');
}),
])
])

]);
}
And when I use Filament\Actions\Action the button appears but doesn't open a modal or execute the code in ->action():
{
return $form
->schema([
TextInput::make('test_input')
->required(),

Actions::make([
Action::make('test')
->action(function () {
//
})
->modal()
->modalHeading('Test')
->extraModalFooterActions([
\Filament\Actions\Action::make('extraActionTest')
->requiresConfirmation()
->action(function () {
dd('test');
}),
])
])

]);
}
{
return $form
->schema([
TextInput::make('test_input')
->required(),

Actions::make([
Action::make('test')
->action(function () {
//
})
->modal()
->modalHeading('Test')
->extraModalFooterActions([
\Filament\Actions\Action::make('extraActionTest')
->requiresConfirmation()
->action(function () {
dd('test');
}),
])
])

]);
}
17 replies
FFilament
Created by binaryfire on 3/12/2024 in #❓┊help
Use anonymous actions inside a modal form
EDIT: This actually works. The problem was caused by something else. Hi all Is there a way of using actions inside a modal form? I don't mean in the footer - I mean in the form body eg:
Actions::make([
Action::make('myModalAction')
->label('Open')
->modal()
->modalHeading('Heading')
->modalDescription('Description')
->modalSubmitActionLabel('Confirm')
->form([
TextInput::make('code')
->required()
->autofocus(),

Actions::make([
Action::make('resend')
->label('Resend code')
->link()
->action(function () {
// do something
}),
]),
])
->action(function ($model) {
// do something
}),
]);
Actions::make([
Action::make('myModalAction')
->label('Open')
->modal()
->modalHeading('Heading')
->modalDescription('Description')
->modalSubmitActionLabel('Confirm')
->form([
TextInput::make('code')
->required()
->autofocus(),

Actions::make([
Action::make('resend')
->label('Resend code')
->link()
->action(function () {
// do something
}),
]),
])
->action(function ($model) {
// do something
}),
]);
This isn't working for me. I'd really prefer to put a "Resend" link under the input instead of a button in the footer.
4 replies
FFilament
Created by binaryfire on 3/10/2024 in #❓┊help
Clean way to avoid escaping of quotes in JS in extraAttributes
Hi all I'm using HtmlString when using JS in extraAttributes() but it's adding slashes before all single and double quotes. The only way I've been able to avoid that is by using Illuminate\Support\Js:
->extraAttributes([
'x-on:click' => new HtmlString('$el.classList.add(' . Js::from('pointer-events-none') . ',' . Js::from('opacity-70') . ')'),
]);
->extraAttributes([
'x-on:click' => new HtmlString('$el.classList.add(' . Js::from('pointer-events-none') . ',' . Js::from('opacity-70') . ')'),
]);
Which isn't very readable... Is there a cleaner of doing this?
7 replies
FFilament
Created by binaryfire on 3/7/2024 in #❓┊help
Override `getColors()` from enum for toggle buttons
Hi all. I'm using an enum in 2 places: a badge column and a toggle button. The badges need to use the colors defined in the enum, but I don't want the toggle button using them. The toggle should just use the default styling (highlight the selected option using the primary color). Any idea how I can do this?
2 replies
FFilament
Created by binaryfire on 3/3/2024 in #❓┊help
Field state is lost on save to JSON columns when invisible
Hi all. Not sure if I'm doing something wrong, but fields that are conditionally hidden using ->visible are getting nulled when saving them to a JSON column. For example let' say I have this:
Section::make('Test')
->schema([
Toggle::make('data.group1.enabled')
->label('Enabled')
->live(),

TextInput::make('data.group1.my_text')
->label('My text')
->visible(fn (Get $get) => $get('data.group1.enabled')),
Section::make('Test')
->schema([
Toggle::make('data.group1.enabled')
->label('Enabled')
->live(),

TextInput::make('data.group1.my_text')
->label('My text')
->visible(fn (Get $get) => $get('data.group1.enabled')),
If I already have something in the text field, then switch the toggle to off and re-save, the value in data.group1.my_text (the text field) is removed. It's as if the field value is set to null when ->visible() is false. Is that normal? I need to be able to hide the dependent field without losing the data on save. Any ideas?
3 replies