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…

  1. 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 the bower_components/angular-toastr to the public/js and public/css folders.
  2. I also install the Angular animate:
    >bower install angular-toastr#0.4.1 -S
    
  3. Add it to resources/views/layout.blade.php ...

Get Laravel 5.x Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.