Created
June 30, 2020 10:51
-
-
Save mpociot/286de510bfc0a88e697284e90ed1d7da to your computer and use it in GitHub Desktop.
livewire test
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
<div> | |
<input wire:model="name" type="text"> | |
<input wire:model="loud" type="checkbox"> | |
<select wire:model="greeting" multiple> | |
<option>Hello</option> | |
<option>Goodbye</option> | |
<option>Adios</option> | |
</select> | |
{{ implode(', ', $greeting) }} {{ $name }} @if ($loud) ! @endif | |
<form action="#" wire:submit.prevent="resetName('Bingo')"> | |
<button>Reset name</button> | |
</form> | |
</div> |
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
<?php | |
use Livewire\Component; | |
class HelloWorld extends Component | |
{ | |
public $name = 'Jelly'; | |
public $loud = false; | |
public $greeting = ['Hello']; | |
public function resetName($name = 'Chico') | |
{ | |
$this->name = $name; | |
} | |
public function render() | |
{ | |
return view('hello-world'); | |
} | |
} |
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
<?php | |
Route::view('/', 'tinkerwell'); | |
Livewire::component('hello-world', HelloWorld::class); |
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
<html> | |
<head> | |
@livewireStyles | |
</head> | |
<body> | |
<h1>Livewire Actions</h1> | |
<livewire:hello-world /> | |
@livewireScripts | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment