In this episode, we're finally getting to build one of the core features: user registration! 🚀
We kick things off by heading to the registration modal we created earlier. Step-by-step, we lay out the form fields for name, email, password, and password confirmation, adding a bunch of Tailwind CSS styles as we go to make everything look decent. We handle errors for each input and talk through why Laravel expects the password confirmation field to have a specific name.
After building and styling all the input fields, we add a "Create Account" button and connect the form up to Inertia's useForm()
helper. This makes managing state and handling form submission really easy. We hook up v-model
for all our fields, and then set the form to submit directly to the Laravel backend endpoint for registration.
Along the way, we solve a couple of gotchas—like making sure Fortify's service provider is registered, and fixing the post-registration redirect so users don’t end up on a blank page. We also make sure our error messages show up nicely under the right fields.
We also cover some good UX practice by disabling the submit button while the form is being processed, so users can’t accidentally submit twice. There's a quick demo of how that works with Tailwind's opacity utilities.
Finally, we use the Head component from Inertia to dynamically set the page title when the modal is visible.
By the end of the lesson, users can fully register, see validation errors if they make a mistake, and know they're signed in—even though we haven't visually indicated that yet (that’s next!).