In this episode, we jump right into getting Laravel Livewire set up in our project. Livewire is what we'll be using to make our forms—especially the create and edit product forms—way more interactive, without needing to write much JavaScript ourselves.
First, we go over how to pull in the Livewire package using Composer. The installation is super fast. We then take care of the required setup by adding a couple of Livewire tags for styles (at the top of our main layout) and scripts (just before the closing </body>
tag) inside app.blade.php
. That’s all it takes to wire up Livewire into our project!
To make sure everything’s working, we use the Artisan command line to spin up a quick Livewire component called hello
. Livewire generates a Blade view (hello.blade.php
) and a PHP component class for us automatically. We throw the component into our dashboard page, and if we can see it show up, we know we’re all good!
Along the way, we chat about how Livewire will let us enhance our forms with stuff like file uploads and auto-generating slugs, without having to build the whole app with it—just the fun, dynamic stuff that’d otherwise take a lot of JavaScript.
So by the end of this episode, you should have Livewire installed, tested, and ready to go for interactive forms in Laravel!