Chrispian
Chrispian
FFilament
Created by Chrispian on 5/19/2024 in #❓┊help
Custom Form Layout Strategy
I'm starting to get requests (finally!) for more complex form layouts. The image is one example. I often have multiple columns and rows and we want form fields in specific orders. I've got that working pretty well with Grid::make() . I've also used Split and Section for some of this. For more complex grid layouts like the screenshot here, what's the best practice? Grid only? Splits for left/right + grids for rows/columns within a split? Some of these get nested/ugly fast and just curious how everyone is solving this. I've also done it with custom views. I often have to come back and edit these forms later so trying to start off the right way. Would love to know how you guys handle this.
6 replies
FFilament
Created by Chrispian on 9/15/2023 in #❓┊help
successRedirectUrl to edit page on replicate()
I want to redirect to the CLONED edit page after I replicate. We don't have the ID until it's cloned, so will this work? I'e tried using successRedirectUrl and I can send it anywhere I want so that obviously works. Just not to the edit page. The error I get is that the $record parameter is missing. Here is my code (based on the code from the docs)
ReplicateAction::make()
->successRedirectUrl(fn (Tile $replica): string => route('tiles.edit', [
'tile' => $replica,
]))
ReplicateAction::make()
->successRedirectUrl(fn (Tile $replica): string => route('tiles.edit', [
'tile' => $replica,
]))
I've tried multiple variations, tried injecting record (which did work, but it was the ORIGINAL record. I need the cloned record. It seems like I should be able to new up record from the replicate but I couldn't get that to work either. Any suggestions to try here? Is this maybe something to be done via Livewire? Stuck on this one.
4 replies
FFilament
Created by Chrispian on 9/15/2023 in #❓┊help
Cloning relationships with ->replicate()
I'm using v2 and added the ->replicate method. Works great. Making some changes in the beforeReplicaSaved hook and all is well. I need to save the relationships. Is this just a matter of doing it the laravel way (per the docs) and just doing that in the after() method or is there another way in Filament? Just wanted to check before I do this the hard way or something lol.
8 replies
FFilament
Created by Chrispian on 5/12/2023 in #❓┊help
Model saved event firing twice
I don't have any custom observers/events in this project. I have a model called File and when I upload a file in Filament the saved event on the model fires twice. When I manually create an entry in this model with tinker it only fires once. Anyone have any ideas? I've looked for stray $model->update() and $model->save() and anything that could be listening. I'm going to try and create a new fresh model to test as well, just curious if anyone has run into this? Searching I can't find anything so I suspect it's something dumb I've done somehow but not seeing it yet.
9 replies
FFilament
Created by Chrispian on 5/4/2023 in #❓┊help
requiresConfirmation modal is empty after composer update
On our staging server one of our developers has update composer (composer update) and the requiresConfirmation() modal is no longer working. The background fades like the modal was triggered and other modals still have their content. It seems to only be happening with the requiresConfirmation. I've tried going back to a previous version of livewire, making sure all caches are cleared, dumping composer autoload etc. The changelog doesn't note anything change with this method and there are no errors in the php log when using the modal. The same code works fine on prod. No errors or warning in console and all logs are empty. The modal is just blank. It's very similar to this, except it happens BEFORE the confirmation instead of after. If you remove the requiresConfirmation() method, works fine. https://github.com/filamentphp/filament/issues/919
protected function getActions(): array
{
return [
Action::make('exports')
// call Maatwebsite Export
->action(fn() => ( new CustomerMageLogExport( $this->getTable() ) ) ) )
->requiresConfirmation(),
];
}
protected function getActions(): array
{
return [
Action::make('exports')
// call Maatwebsite Export
->action(fn() => ( new CustomerMageLogExport( $this->getTable() ) ) ) )
->requiresConfirmation(),
];
}
Attached are the currently installed libs. Any ideas of things to try? The thread linked above the error just went away but nothing we've tried seems to work. I suspect some sort of conflict but there are no errors anywhere so it's hard to track down. I'm still digging and will update if I find anything.
5 replies
FFilament
Created by Chrispian on 4/13/2023 in #❓┊help
Sticky Table Headers and Columns
I've been fighting with this one for a bit. I can apply styles using a custom theme of course. The color takes effect and the Tailwind sticky class is applied. Top 0 is also applied. When I inspect, this is also in the dom and converts properly to position: sticky with top: 0. .filament-tables-header-cell { @apply bg-red-200 sticky top-0 } It's my understanding that TH can be sticky. I can remove the sticky or top 0 from the nav bar and it goes back to normal. I can't seem to get this to work. Any ideas? People want that excel like feature where the table header and first couple columns are "locked" because they will be scrolling/editing this data often.
20 replies
FFilament
Created by Chrispian on 4/4/2023 in #❓┊help
Form with no model
We have to process uploads on a regular basis. So far we've cheated and put the form upload into one table (model) and the data into another table (model). But we have several cases where we simply don't need to store the file. We want the data inside the file import into a model. For example we have a CSV with serial numbers and want to import them into a model called serial numbers. I don't think the right thing to do is put a form field on the serial number model. What I've done so far is simply hooked into the saved event for the model and parsed the upload and saved it to the data table for that file model. I think we could accomplish the same results by creating a custom page with a custom widget that has the file upload form on it. And then simply clean parse the file (either via queue or inline if small). Just want to make sure I'm on the right track here before we get too far into these projects. Anyone done this and happen to have an example? This need comes up super often. We are using the entire Filament suite (admin panel, form builder, table builder and notifications, just for reference). Everything is inside the Admin Panel.
6 replies