The Edit Page
The Edit page displays a form for modifying existing records. It’s defined inEditCustomer.php:
packages/panels/src/Resources/Pages/EditRecord.php
Form Prefilling
When the page loads, the form is automatically filled with the record’s data. Themount() method handles this:
packages/panels/src/Resources/Pages/EditRecord.php
Customizing Data Before Fill
Modify data before it’s loaded into the form:- Formatting Dates
- Hiding Sensitive Data
Lifecycle Hooks
Execute code at specific points during editing:packages/panels/src/Resources/Pages/EditRecord.php
Mutating Data Before Save
Modify form data before it’s saved:packages/panels/src/Resources/Pages/EditRecord.php
This runs after validation but before
beforeSave().Customizing the Saving Process
Override how records are updated:packages/panels/src/Resources/Pages/EditRecord.php
Redirects After Save
By default, users stay on the Edit page after saving.Redirect to List Page
Redirect to View Page
Stay on Page
Global Configuration
Success Notifications
Customize the success notification:packages/panels/src/Resources/Pages/EditRecord.php
Saving Form Sections Independently
Allow users to save individual form sections:Halting the Save Process
Stop saving at any point:Refreshing Form Data
Refresh specific fields from the database:packages/panels/src/Resources/Pages/EditRecord.php
Header Actions
Add actions to the page header:Custom Form Actions
Add buttons below the form:Moving Save to Header
Multiple Edit Pages
Create additional Edit pages for complex resources:1
Generate the page
2
Register it
3
Define its form
Authorization
Users can access the Edit page if theupdate() method of the model policy returns true:
delete() returns true:
Database Transactions
Edit pages automatically wrap saves in database transactions. This is controlled by theCanUseDatabaseTransactions trait.
To disable transactions:
Unsaved Changes Alert
TheHasUnsavedDataChangesAlert trait warns users when they try to leave with unsaved changes. This is enabled by default.