-
-
Notifications
You must be signed in to change notification settings - Fork 86
Model binding
tanthammar edited this page Nov 18, 2020
·
6 revisions
It can either be a new Model
instance or an existing one.
public function mount(?SomeEloquentModel $model) {
//Laravel automatically creates a new instance, if none is passed in the route
$this->mount_form($model);
}
blade
<livewire:some-component :model="$some_model" />
component
public function mount($model) {
$this->mount_form($model);
}
Using Livewire route, full-page components web.php
Route::get('/user/{user}', UserForm::class);
component
public function mount(User $user) {
$this->mount_form($user);
}
Using Livewire route, full-page components web.php
Route::get('/user/{user?}', UserForm::class);
component
public function mount(?User $user) {
//Laravel automatically creates a new User if none is passed in the route
$this->mount_form($user);
}
- 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