How to Build a Blog with Laravel
Part 12 - Inserting Data and Validating [How to Build a Blog with Laravel 5 Series]
Hide/Show description
This video is all about storing our data. This will mark the first time we have actually sent information over to the database to be stored for later use. But don’t worry it’s easy!
When creating our store() action we generally follow these steps
1. Validate the data
2. Store it in database
3. Redirect to either show() or index()
Validation is super easy in Laravel 5. We simply need to use the validate function. Link below to see all of the validation rules available to us.
With Laravel 5.2 validation we can simply pass in the rules and Laravel handles the rest. It will automatically redirect us back to the previous page with errors in the session flash (something we learn about in part 13).
We can safely write code under the validate() method and know that all data has passed validation. To enter something in our database we simply create a new Post object and then add the data into that object and finally submit it to the database with the save() method on that object.
--- MORE FROM THIS SERIES ---
Previous Video [Part 11]: https://youtu.be/El4yziFuygQ
Next (optional) video [Part 12 ½]: https://youtu.be/JmvHTg0sy6o
Next Video [Part 13]: coming soon
Full Playlist for the "How to Build a Blog with Laravel" Series: https://www.youtube.com/playlist?list...
--- LINKS ---
Laravel Documentation for Validations: https://laravel.com/docs/master/valid...
--- FOLLOW ME ---
Twitter - http://twitter.com/_jacurtis
---
Tags: Laravel 5 Framework Tutorial Easy to learn. Best tut about Laravel. Blade and validations on the server side. Laravel 5.2 and database mysql. Insert into database with PHP framework. Build a blog with Laravel Tutorial. Beginner tutorial. How to video. PHP framework easy best tutorial.
-
How to Build a Blog with Laravel - Part 1 (Exploring File Structure)
Part 2 - What is MVC [How to Build a Blog with Laravel 5 Series]
Part 3 - Getting Started [How to Build a Blog with Laravel 5 Series]
Part 4 - Controller Basics [How to Build a Blog with Laravel 5 Series]
Part 5 - Passing Data to a View [How to Build a Blog with Laravel 5 Series]
Part 5½ - Designing our Blog Pages [How to Build a Blog with Laravel 5 Series]
Part 6 - Layouts with Blade [How to Build a Blog with Laravel 5 Series]
Part 7 - Partials with Blade [How to Build a Blog with Laravel 5 Series]
Part 8 - Model Basics [How to Build a Blog with Laravel 5 Series]
Part 9 - Migration Basics [How to Build a Blog with Laravel 5 Series]
Part 10 - CRUD and RESTful Routes [How to Build a Blog with Laravel 5 Series]
Part 11 - "Create" function and Forms in Laravel [How to Build a Blog with Laravel 5 Series]
Part 12 - Inserting Data and Validating [How to Build a Blog with Laravel 5 Series]
Part 12½ - Javascript Form Validation [How to Build a Blog with Laravel 5 Series]
Part 13 - Sessions & Flash Messages [How to Build a Blog with Laravel 5 Series]
FAQs [How to Build a Blog with Laravel]
Part 14 - Reading from our Database [How to Build a Blog with Laravel 5 Series]
Part 15 - Working with Dates from Database [How to Build a Blog with Laravel 5 Series]
Part 16 - Read our CRUD [How to Build a Blog with Laravel 5 Series]
Part 16½ - Fixing a Bug, Making Navigation States work [How to Build a Blog with Laravel Series]
Part 17 - Model-Form Binding [How to Build a Blog with Laravel 5 Series]
Part 18 - Updating Form Data to Database [How to Build a Blog with Laravel 5 Series]
Part 19 - Deleting Resources with CRUD [How to Build a Blog with Laravel 5 Series]
Part 20 - Pagination in Laravel [How to Build a Blog with Laravel 5 Series]
Part 21 - Query Builder [How to Build a Blog with Laravel Series]
Part 22 - Adding Slug URLs to Our Blog [How to Build a Blog with Laravel Series]
Part 23 - Adding Slugs to our Posts CRUD [How to Build a Blog with Laravel 5 Series]
Parts 24 - Slugs in our URL Routes [How to Build a Blog with Laravel 5 Series]
Part 24 ½ - Fixing a Slug Bug [How to Build a Blog with Laravel Series]
Part 25 - Adding Features to our Blog Controller [How to Build a Blog with Laravel 5 Series]
Part 26 - Authentication Theory and Overview [How to Build a Blog with Laravel 5 Series]
Part 27 - Laravel Authentication Routes Views [How to Build a Blog with Laravel Series]
Part 28 - Authentication Methods [How to Build a Blog with Laravel 5 Series]
Part 29 - Authentication User Experience [How to Build a Blog with Laravel 5 Series]
Part 30 - Password Reset Emails [How to Build a Blog with Laravel 5 Series]
Part 30½ - Authentication Shortcut [How to Build a Blog with Laravel 5 Series]
Part 31 - Blog Categories and Learning Relationships [How to Build a Blog with Laravel 5 Series]
Part 32 - Categories CRUD [How to Build a Blog with Laravel Series]
Part 33 - Assigning Categories to Posts [How to Build a Blog with Laravel Series]
Part 34 - Many to Many Relationships [How to Build a Blog with Laravel 5 Series]
Part 35 - Building Our Tag Model [How to Build a Blog with Laravel 5 Series]
Part 36 - Starting our Tag CRUD [How to Build a Blog with Laravel 5 Series]
Part 37 - Adding Tag UI/UX [How to Build a Blog with Laravel 5 Series]
Part 38 - Show, Edit, Update our Tags [How to Build a Blog with Laravel 5 Series]
Part 39 - Deleting Tags Safely [How to Build a Blog with Laravel 5 Series]
Part 40 - Sending Email from Contact Form [How to Build a Blog with Laravel 5 Series]
Part 41 - Adding Comments [How to Build a Blog with Laravel 5 Series]
Part 41½ - Styling our Comments [How to Build a Blog with Laravel 5 Series]
Part 42 - Managing Comments [How to Build a Blog with Laravel 5 Series]
Part 43 - Adding a WYSIWYG Editor [How to Build a Blog with Laravel 5 Series]
Part 44 - Output HTML from Database [How to Build a Blog with Laravel 5 Series]
Part 45 - Security Concerns with WYSIWYG Editors [How to Build a Blog with Laravel 5 Series]
Part 46 - Image Upload for Posts [How to Build a Blog with Laravel 5 Series]
Part 47 - Validating, Updating, and Deleting Images [How to Build a Blog with Laravel 5 Series]