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.
Validating form submissions
From the course: Building Laravel and Vue.js 2 Web Apps
Validating form submissions
- [Narrator] In this video, we'll look at how to add server side validation for Laravel models. So now, we'll finally get around to creating a model and a database table for menu items. In our homestead shell, we'll do artisan make model this will be called menu item and again, the M option to add a migration and R to create a resource controller. So if we open up that migration now we're going to be a little bit more detailed than we were last time with the category table. So I'm going to start with the name and description columns. These will be string columns, or VARCHAR when they're created in MySQL. And this time, we'll give them max lengths. Name 128 and for description (typing) we'll set the max to 512. Next we'll do the price for the menu item this will be a decimal column. And I could do a precision and scale there but if I just use the default this will allow me to use 8 digits total, including 2 decimal places which should be fine for the price of a menu item. Just like…
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
-
-
-
-
-
Protecting admin pages with gates4m 30s
-
(Locked)
Installing and configuring Vue Router4m 56s
-
(Locked)
Using props and router-link4m 50s
-
(Locked)
Enabling Vue Router history mode5m 38s
-
(Locked)
Validating form submissions5m 23s
-
(Locked)
Displaying model validation errors5m 43s
-
(Locked)
Managing file uploads6m 50s
-
(Locked)
Working with related models4m 39s
-
(Locked)
Building a list view with detail links6m 4s
-
(Locked)
Reusing form components3m 56s
-
(Locked)
Using Laravel form requests3m 48s
-
(Locked)
Using Vue Router navigation guards3m 37s
-
-
-