Match the value to your model
Changing a storage mode may change the value contract. Use the component’s reference before replacing an existing field or reusing an existing column.
A simple text value
For the signature tutorial, the column and field share the namesignature:
signature to the model’s existing assignment policy. The standard resource create/edit actions then save the field to that attribute. A blank signature fails validation; a valid drawing saves as SVG text and restores on edit.
A structured JSON value
This example adds opening hours to an existingApp\Models\Location model and locations table. Use your application’s model and table names.
1
Prepare the JSON column
Migration body
2
Add the model cast
Merge these entries into the model’s existing settings:Keep existing fillable attributes and casts. The array cast makes the saved JSON available as a PHP array when the edit form is filled.
app/Models/Location.php
3
Add the validated schedule
Append the field to the Location resource’s existing form:The standard resource save validates the submitted schedule before persisting the attribute. Reopen the location to verify that the periods and timezone return.
Resource field
ScheduleField explains breaks, overnight periods and protected day states. A weekly schedule describes hours; it does not reserve appointments or prevent concurrent bookings.
Date, datetime and time columns
Keep display formatting separate from storage formatting:Resource fields
Migration body
Model casts
opens_at as the time string; Eloquent has no standard time cast. For this example, use UTC consistently as the application’s datetime storage convention.
timeZone() supplies calendar Today and the timezone label. It does not convert stored wall time into another timezone. If users enter local times and your application stores UTC, implement that conversion deliberately in the application’s save/read workflow. A date-only value is a calendar day, not a timestamp.start and end together; use JSON or explicitly map the endpoints to separate columns. See date/time configuration for precision, storage formats and unavailable dates.
Save from your own Livewire component
This example edits the signed-in user’s SVG signature inside an already configured Filament panel. It assumes your existingUserPolicy::update() authorizes the operation and the signature column and assignment policy from the tutorial are ready.
app/Livewire/EditSignature.php
@livewire('edit-signature') in your authenticated panel page:
resources/views/livewire/edit-signature.blade.php
fill() prepares restored data for the field. getState() validates and produces the value to persist. Authorization is checked on submission too. This example uses the default text signature mode; media-backed fields need their record completion hooks as well.
Apply business rules and permissions
A valid option identifier is not proof that the user may assign that record. Limit both the visible options and the server rule. For example, an existingApp\Models\Project model has a user_id owner column:
project_id is a scalar foreign-key attribute; relationship-saving configurations have their own setup. For large option sets, replace the full pluck() with the paginated Select provider.
Control whether a field is saved
Use explicit persistence settings when displaying information that must not update a column. Relationship fields can have separate save behavior. Filament’s field lifecycle documentation explains the framework behavior these fields participate in.
Files have a record lifecycle too
Temporary upload, permanent file storage, record acceptance and background conversions are separate milestones. Database transactions do not also transact object storage. Configure file types, size and dimensions on the upload, then use Upload events & recovery for staging and completion in a custom save workflow. Metadata in disk mode uses a separate companion attribute. Native and Spatie conversions retain the stored original.Validate other write paths
An API endpoint, import or queued job can bypass this form. Apply the relevant validation, permissions and tenant restrictions there too. A control’s browser checks do not validate arbitrary Eloquent writes. For extension values, use the public submission contract and validation guide.Upload storage & validation
Configure shared rules for file, URL and camera sources.
Troubleshoot saved values
Check columns, casts and your save action.