Validating incoming input
The previous work did not cover validation. We could check for comic
, and then check that the user is the owner. What I will do here is show how to use Form Request Validation to validate the incoming request.
Getting ready
If you have been following along, you have the app/Http/Controllers/FavoriteCreate.php
controller in place, so we are going to add validation to it.
How to do it…
Add
toastr
so that we can notify people as needed (https://github.com/Foxandxss/angular-toastr); you will see in the next layout that I had to move several files from thebower_components/angular-toastr
to thepublic/js
andpublic/css
folders.I also install the Angular animate:
>bower install angular-toastr#0.4.1 -S
Add it to
resources/views/layout.blade.php
:Add it at the bottom of the file as well:
Register it with the app called
public/js/app.js
:Then, add it to our handle error area:
Let's make the form called
request
:>php artisan make:request FavoriteCreateRequest
Then, add what...