Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Laravel 5.x Cookbook

You're reading from   Laravel 5.x Cookbook A recipe-based book to help you efficiently create amazing PHP-based applications with Laravel 5.x

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher Packt
ISBN-13 9781786462084
Length 402 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Terry Matula Terry Matula
Author Profile Icon Terry Matula
Terry Matula
Alfred Nutile Alfred Nutile
Author Profile Icon Alfred Nutile
Alfred Nutile
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Setting Up and Installing Laravel FREE CHAPTER 2. Using Composer Packages 3. Routing 4. Building Views and Adding Style 5. Working with Data 6. Adding Angular to Your App 7. Authentication, Security, and Subscriptions 8. Testing and Debugging Your Application 9. Adding Advanced Features to Your App 10. Deploying Your App Index

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:

    Add it at the bottom of the file as well:

  4. Register it with the app called public/js/app.js:

  5. Then, add it to our handle error area:

  6. Let's make the form called request:

    >php artisan make:request FavoriteCreateRequest
    
  7. Then, add what...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image