-
-
Notifications
You must be signed in to change notification settings - Fork 86
Form Data
tanthammar edited this page Nov 13, 2020
·
7 revisions
public Model $model;
public array $form_data;
- The data is always accessible via:
data_get($this->form_data, 'foo')
- or the fields
name
property, like$this->foo
, depending on how you setup your form - In Lifecycle Hooks you access custom field data via
data_get($this->form_data, 'foo')
The model you pass in the mount_form($model)
method is accessed as $this->model
public function onCreateModel()
{
data_set($this->form_data, 'password', Hash::make(data_get($this->form_data, 'password')));
//or
$this->form_data['password'] = Hash::make($this->form_data['password']);
$this->model = User::create($validated_data);
}
This data is never available in the form_data
property, you access it with $this->foo
because Livewire v2 requires you to define the property on the component.
- Installation
- Requirements
- v5 Upgrade Guide
- v6 Upgrade Guide
- v7 Upgrade Guide
- Support
- Quickstart
- Manual installation
- Optional
- Form component
- Field
- Field types
- Example Form
- Blade Components
- Notifications