In this episode, we start off by sprucing up the styles of our task list, making things look a bit cleaner and more organized using flex layout and some spacing tweaks. Once that’s out of the way, we jump into building a form that lets users create new tasks.
You'll see how to quickly put together the form by reusing some code from the register page, adapting it to collect a task title instead. We go through the process of setting up the form state, handling the submit event, and hooking it up to a route that saves the new task. There's a bit of fiddling around in the backend: we add a store
method to the controller, make sure the title gets validated, and ensure new tasks are created with the authenticated user.
After the basics are working, we handle a few hiccups—like fixing route names and mass assignment issues—until everything is flowing smoothly. Once the form works (and shows up in the task list as it should!), we jump over to writing an end-to-end feature test using Laravel Dusk. The test lands on the create page, fills out the form, submits it, waits for the redirect, and checks that the new task appears.
Finally, we wrap up by prepping for the next episode, where we’ll look at testing the database directly to make sure that the tasks are actually being stored as expected. All in all, it’s a practical walkthrough of how to add a create-task form, hook it up, and verify it with automated browser tests.