Access all articles in sprocket icon.
Published February 14, 2017 by Bill Keck.
Dependent Dropdown Form Vue.js and Laravel 5.4
I have officially released chapter 15 of Laravel 5.4 For Beginners today on Valentine’s Day. This bonus material is free for anyone who has purchased the book. Updates to the book are free for the life of the book, one of the great things about the leanpub.com platform.
With the release of chapter 15, it brings the page count to over 900 pages. It may be 900 pages, but it’s a gentle 900 pages, generous with screenshots and code.
Chapter 15 focuses on a robust example of dependent dropdown lists on a form. We set up all models, so the data for the lists can be pulled into the form, which uses a custom Vue.js component to enforce the dependency.
In the chapter we work on a Lesson model, which has a category and a subcategory. The subcategory belongs to a specific category, so we only want to show the subcategories that belong to it in the form. By explicitly naming the parent/child as category and subcategory, it makes it easy to follow and keep track of which one is the child.
We also want to enforce the dependency through server-side validation, which prevents the form from being spoofed. Projects tend to eventually have some kind of complicated validation, so we walk through the options for creating that. It turns out it’s pretty simple to do.
A lot of my readers have bought my previous books, and this puts a lot of pressure on me, when I do a new release, to make the new book worth purchasing.
With that said, here is some of what is covered in this book that is new to this book:
- Laravel Mix (Replaces Elixer)
- Sending Mail and the new Markdown features
- Service Container
- Service Providers
- Dynamic Facades
- Query Scopes
- Real-time Chat with Laravel Echo, Vue.js, and Pusher
- Custom command to run as cron to cleanup old chat messages
- Dependent Dropdown list on form with Vue.js
Laravel 5.4 For Beginners is no substitute for a dedicated book on Vue, my favorite for that is The Majesty of Vue 2, but Laravel 5.4 For Beginners can help you get up and running, teach you the basics, and help you take advantage of some of the really cool reactivity we can create with Vue.
Other fundamentals we cover are image management, access control, middleware, and one-click Facebook sign in and registration with Socialite. My goal is to help you advance your programming knowledge, so that if you start the book as a beginner, you end it being more intermediate.
I’ve always felt that programming is a journey that Laravel makes more pleasant and productive, and I’m happy to share that journey with you.
Thanks again to everyone who is supporting my work by purchasing the book. Please leave a rating or review at GoodReads.com, it will help get the word out for the book, I really appreciate it.