diff --git a/README.md b/README.md index 8ec93fc..1b2ef52 100644 --- a/README.md +++ b/README.md @@ -23,16 +23,62 @@ This package only provides a wrapper for the `@livewireScripts`, `@livewireStyle You can register your Livewire components like normal. ## Example +In the head ```twig {{ livewireStyles() }} +{{ livewireScripts() }} +``` + +In the body +```twig {# The Twig version of '@livewire' #} {% livewire counter %} {# If you wish to pass along variables to your component #} {% livewire counter with {'count': 3} %} +``` -{{ livewireScripts() }} +In resources/views/livewire/counter.twig +```twig +
+
+
+
{{ count }}
+
-
+
+``` +In app/Http/Livewire/Counter.php +```php +count = $count; + } + + public function add() + { + $this->count++; + } + + public function subtract() + { + $this->count--; + } + + public function render() + { + return view('livewire.counter'); + } +} ``` ## Todo