From the course: Building Laravel and Vue.js 2 Web Apps
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Building a CRUD component
From the course: Building Laravel and Vue.js 2 Web Apps
Building a CRUD component
- [Instructor] Now we'll start turning this view component into a form for managing the category records. We'll want to be able to add to, edit, or delete the categories in this prop, but it's a bad practice to mutate props, since our changes can easily be overwritten by a parent component. Here we don't have a parent component, but we will later on, and even if that parent component won't be updating the data, we'll be better off if we don't get in the habit of breaking this rule. So first, let's give this component its own data. We'll change the prop name to initial categories, both in the component and in the blade view, and in an html template, I want to use Kebab case like that. Then, we'll just initialize a data property called categories with this dot initial categories as its default value, but because a raise in objects are passed by reference in Javascript, this won't prevent us from mutating the prop at all, since categories is now just a reference to the same initial…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Integrating a layout6m 46s
-
(Locked)
Creating a model and seeding the database4m 46s
-
(Locked)
Building views with Blade templates5m 6s
-
(Locked)
Injecting props in Vue components4m 49s
-
(Locked)
Building a CRUD component5m 9s
-
(Locked)
Managing scrolling and focus4m 18s
-
(Locked)
Protecting routes and models with policies5m 5s
-
(Locked)
Building an API with Laravel Passport5m 1s
-
(Locked)
Calling an API from Vue7m 46s
-
-
-
-