Created
July 21, 2021 01:14
-
-
Save ph7jack/49365e21b97a469b4ad88e0cf442d5d8 to your computer and use it in GitHub Desktop.
livewire model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Form.php | |
<?php | |
namespace App\Http\Livewire; | |
use Livewire\Component; | |
class Form extends Component | |
{ | |
public ?string $name = 'pedro'; | |
public function render() | |
{ | |
return view('livewire.form'); | |
} | |
} | |
form.blade.php | |
<div> | |
<div class="grid grid-cols-2"> | |
<div> | |
name: {{ $name }} | |
<br> | |
<input class="border" wire:model="name" /> | |
</div> | |
<livewire:input wire:model="name" /> | |
</div> | |
</div> | |
Input.php | |
<?php | |
namespace App\Http\Livewire; | |
use Livewire\Component; | |
class Input extends Component | |
{ | |
public ?string $model = null; | |
public function render() | |
{ | |
return view('livewire.input'); | |
} | |
} | |
input.blade.php | |
<div> | |
model: {{ $model }} | |
<br> | |
<input class="border" wire:model="model" /> | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment