You're browsing the documentation for an old version of Livewire. Consider upgrading your project to Livewire 3.x.
Making Components
Run the following artisan command to create a new Livewire component:
1php artisan make:livewire search-posts
Two new files were created in your project:
app/Http/Livewire/SearchPosts.php
resources/views/livewire/search-posts.blade.php
If you wish to create components within folders, you can use dot-notation:
1php artisan make:livewire post.search
Now, the two created files will be in sub-folders:
app/Http/Livewire/Post/Search.php
resources/views/livewire/post/search.blade.php
Inline Components
If you wish to create Inline components (Component's without .blade.php
files), you can add the --inline
flag to the command:
1php artisan make:livewire search-posts --inline
Now, only one file will be created:
app/Http/Livewire/SearchPosts.php
← Previous Topic
Installation
Next Topic →
Rendering Components