© 2026 Hedgehog Software, LLC

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

using associative array for table/form schema array

is there any concern in using associative array for form/table schema, eg:
// default form schema
function defaultRegistrationForm(){
  return [
    'name' => TextInput::make('name'),
    'email' => TextInput::make('email'),
  ];
}

function getRegistrationFormSchema(){
  // handle form schema customization
}

// form
$form->schema($this->getRegistrationFormSchema())
// default form schema
function defaultRegistrationForm(){
  return [
    'name' => TextInput::make('name'),
    'email' => TextInput::make('email'),
  ];
}

function getRegistrationFormSchema(){
  // handle form schema customization
}

// form
$form->schema($this->getRegistrationFormSchema())


and then I will have some api to customize the schema fields, eg:
  RegistrationForm::add(fn() => ['mobile' => TextInput::make('mobile'));
  RegistrationForm::before('name', ['salutation => ...]);
  RegistrationForm::add(fn() => ['mobile' => TextInput::make('mobile'));
  RegistrationForm::before('name', ['salutation => ...]);


this may also extend to any methods in filament that return array such as
getHeaderActions
getHeaderActions
array etc


is this a pattern that Filament would advise against with?
Solution
i cant imagine any immediate issues, but i cannot guarantee that the key will not be lost at some point in the form process and replaced with a nunber
Jump to solution
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

Select and TextColumn with Associative Array
FilamentFFilament / ❓┊help
2y ago
Using json properties for form schema
FilamentFFilament / ❓┊help
12mo ago
Using form schema for PDF export
FilamentFFilament / ❓┊help
3y ago
Table form array without BBDD
FilamentFFilament / ❓┊help
3y ago