© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•6mo ago
larsbo

Replicate - but display form instead of saving directly.

I want to duplicate a model instance and some required fields should be ignored. In this case the standard replicate action fails because the confirm modal only shows a confirm button and by pressing it the duplicated cannot be saved in the database because of the ignored non-nullable columns.
I found this v3 thread but the solution does not work: ❓┊helpReplicate action: load form instead of save
After analyzing the core code I found that the solution as simple as adding a
$this->schema()
$this->schema()
.

So here is my working custom action class that displays my form inside the replicate modal and allows to fill out the not replicated, required fields:
class ReplicateToolAction extends ReplicateAction
{
    protected function setUp(): void
    {
        parent::setUp();

        $this->schema(fn (Schema $schema) => ToolForm::configure($schema));  // the simple solution

        $this->excludeAttributes([
            'inventory_number',
            'serial_number',
            'last_maintenance_at',
        ]);
    }
}
class ReplicateToolAction extends ReplicateAction
{
    protected function setUp(): void
    {
        parent::setUp();

        $this->schema(fn (Schema $schema) => ToolForm::configure($schema));  // the simple solution

        $this->excludeAttributes([
            'inventory_number',
            'serial_number',
            'last_maintenance_at',
        ]);
    }
}


Maybe this helps other. 😀
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Replicate action: load form instead of save
FilamentFFilament / ❓┊help
2y ago
->relationship() on form field directly?
FilamentFFilament / ❓┊help
4mo ago
Directly Passing Form in modalContent
FilamentFFilament / ❓┊help
3y ago
Wizard Form display a modal after submit instead a redirect
FilamentFFilament / ❓┊help
2y ago