© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago
Pablo Torres

Send data from edit page to create page on a different resource.

Im using Laravel v10 and Filament PHP v3
I have the following models:

Client
LegacyClient

I want to allow users to re-use the legacy client data to create a new client record.
For this I want to create a form action that 'sends' the data from the form in EditLegacyClient.php page to the form in CreateClient.php page.

On my EditLegacyClient.php page I have:

protected function getHeaderActions(): array
    {
        return [
            // Recycle Legacy Client Data Action btn.
            Action::make('recycle')
                ->label('New Client (Recyle)')
                ->action(function (array $data): void {
                    //Data from the form in EditLegacyClient.php
                    $name = $data['name'];
                    $telephone = $data['telephone'];

                    //Variables to be sent to the form in CreateClient.php page
                    $data['name'] = $name;
                    $data['telephone'] = $telephone;
                })
                ->color('warning')
                ->icon('heroicon-s-arrow-path')
                ->requiresConfirmation()
                ->modalHeading('Create new client using Legacy Client data?')
                ->modalDescription('Confirm your intention to reuse this legacy client data to create a new client record.')
                ->modalSubmitActionLabel('New Client (Recyle)')
                ->visible(
                    fn () => in_array(Auth()->user()->role, ['SUPERADMIN', 'ADMIN', 'MANAGER', 'ASSOCIATE'])
                ),
        ];
    }
protected function getHeaderActions(): array
    {
        return [
            // Recycle Legacy Client Data Action btn.
            Action::make('recycle')
                ->label('New Client (Recyle)')
                ->action(function (array $data): void {
                    //Data from the form in EditLegacyClient.php
                    $name = $data['name'];
                    $telephone = $data['telephone'];

                    //Variables to be sent to the form in CreateClient.php page
                    $data['name'] = $name;
                    $data['telephone'] = $telephone;
                })
                ->color('warning')
                ->icon('heroicon-s-arrow-path')
                ->requiresConfirmation()
                ->modalHeading('Create new client using Legacy Client data?')
                ->modalDescription('Confirm your intention to reuse this legacy client data to create a new client record.')
                ->modalSubmitActionLabel('New Client (Recyle)')
                ->visible(
                    fn () => in_array(Auth()->user()->role, ['SUPERADMIN', 'ADMIN', 'MANAGER', 'ASSOCIATE'])
                ),
        ];
    }


Can someone please help me on how can I send the data across from the form in EditLegacyClient.php page to the form in CreateClient.php page?

Thanks...
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Create, Edit Page of a Resource to Modal
FilamentFFilament / ❓┊help
3y ago
Opening edit modal from a different resource (simple modal resources)
FilamentFFilament / ❓┊help
3y ago
Table on resource edit page?
FilamentFFilament / ❓┊help
3y ago
Call the "edit" modal for a record in a resource from a different page
FilamentFFilament / ❓┊help
2y ago