© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Miyatake

How to create a resource record from another resource?

Hello, I'm creating a Booklet record from a modal in my Customer resource.
The record is being saved, but I'm not getting the created notification. How can I properly create the record this way?

This is my action button in my customers table:
Action::make('New Booklet')
  ->icon('heroicon-m-plus')
  ->form([
      TextInput::make('customer_id')
          ->default(fn(Customer $customer) => $customer->code)
          ->readOnly(true),
      Select::make('store_id')
          ->options(Store::all()->pluck('name', 'id'))
          ->required()
          ->native(false)
  ])
  ->action(function (array $data): void {
      Booklet::create([
          'customer_id' => $data['customer_id'],
          'store_id' => $data['store_id'],
          'user_id' => Filament::auth()->id(),
      ]);
  }),
Action::make('New Booklet')
  ->icon('heroicon-m-plus')
  ->form([
      TextInput::make('customer_id')
          ->default(fn(Customer $customer) => $customer->code)
          ->readOnly(true),
      Select::make('store_id')
          ->options(Store::all()->pluck('name', 'id'))
          ->required()
          ->native(false)
  ])
  ->action(function (array $data): void {
      Booklet::create([
          'customer_id' => $data['customer_id'],
          'store_id' => $data['store_id'],
          'user_id' => Filament::auth()->id(),
      ]);
  }),
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

How do I correctly create a link to a record from another view?
FilamentFFilament / ❓┊help
3y ago
Passing record to resource create page
FilamentFFilament / ❓┊help
2y ago
Createaction that opens a create page from another resource
FilamentFFilament / ❓┊help
2y ago
How to open a resource modal from another page
FilamentFFilament / ❓┊help
3y ago