© 2026 Hedgehog Software, LLC

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

Resource Edit Form Not Populating Values - Model Field Names Mapped to Table Column Names

Hi all,

I have to build a front-end on an existing database with horrendous and inconsistent naming of column names. I have mapped sensible names in the Model to the table column names with a bunch of get/set attribute methods. For example

public function setCompanyNameAttribute($company_name){
        $this->attributes["Company Name"] = $company_name;
 }
public function setCompanyNameAttribute($company_name){
        $this->attributes["Company Name"] = $company_name;
 }


When using plain blade templates I need to either map the form element ids to the exact column name or, in the controller, merge the request paramters with the database column names to get eloquent queries to work. When a model instance is used it all works fine and no extra work is needed.

I now want to use filament forms to be able to list/edit/create etc the model objects. I can get the table method in my Resource to return and display the right columns using the model property names. Table is quite good as it can even use the database column names and still work.

The issue I have is editing a row/model instance. The form displays but the existing values are not populated. If I enter data and save, the changes are saved. So far I have just replaced all values as the fields are required.

I have searched, and queries chatgpt but can't find a way to be able to map the form fields and model properties to get the fields to populate the old values. Any ideas, pointers or solutions? Thanks
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

Custom Edit Form Input Values Not Populating Input values
FilamentFFilament / ❓┊help
3y ago
PAGE form field default not populating field
FilamentFFilament / ❓┊help
6mo ago
Edit Resource model
FilamentFFilament / ❓┊help
3y ago
Unable to edit Resource in Resource table
FilamentFFilament / ❓┊help
2y ago