#115 Make E-com in Laravel 5.7 / 5.8 | Upgrade to Laravel 5.8 | Laravel Validations | Contact Form
In Part-115 of E-com Series, we will first upgrade our Laravel 5.7 project to Laravel 5.8 that recently launched and after that we will add Laravel validations to the contact form.
1) Update composer.json file :-
First of all, update laravel/framework to 5.8.* from 5.7.* at composer.json file located at the root of our Laravel project.
2) Run "composer update" command :-
Now run "composer update" command to upgrade laravel 5.7 to 5.8 of our Laravel project. Verify once with php artisan --version to make sure laravel version has been updated to 5.8
Now we can continue working on Contact form and will add Laravel validations this time. We can take help from below Laravel link :-
https://laravel.com/docs/5.8/validation
3) Update contact function :-
Update contact function located at CmsController and write validator code for name and email as shown in video.
4) Update contact.blade.php file :-
Now update contact.blade.php file to display the error if validation fails for name or email. You can check this at Laravel website https://laravel.com/docs/5.8/validation#rule-email under "Displaying The Validation Errors" section.
5) Update Header Statement :-
Now add below statement at the top of CmsController :-
use Validator;
Check now validation is working fine. Now we will make it more secure by adding more options in validation.
6) Update contact function :-
We want to allow the user to add alphabets only and laravel provides alpha option but it will not allow spaces so we will search on net for better solution.
Search for the keyword like 'laravel validation for alphabetic characters and spaces' and open below stackoverflow link to find the solution.
https://stackoverflow.com/questions/34099777/laravel-5-1-validation-rule-alpha-cannot-take-whitespace
We will add regular expression for allowing alphabets with spaces as shown in video.
We can add other validation rules as well from Laravel website :-
https://laravel.com/docs/5.8/validation#available-validation-rules
Thanks for watching :)
Видео #115 Make E-com in Laravel 5.7 / 5.8 | Upgrade to Laravel 5.8 | Laravel Validations | Contact Form канала Stack Developers
1) Update composer.json file :-
First of all, update laravel/framework to 5.8.* from 5.7.* at composer.json file located at the root of our Laravel project.
2) Run "composer update" command :-
Now run "composer update" command to upgrade laravel 5.7 to 5.8 of our Laravel project. Verify once with php artisan --version to make sure laravel version has been updated to 5.8
Now we can continue working on Contact form and will add Laravel validations this time. We can take help from below Laravel link :-
https://laravel.com/docs/5.8/validation
3) Update contact function :-
Update contact function located at CmsController and write validator code for name and email as shown in video.
4) Update contact.blade.php file :-
Now update contact.blade.php file to display the error if validation fails for name or email. You can check this at Laravel website https://laravel.com/docs/5.8/validation#rule-email under "Displaying The Validation Errors" section.
5) Update Header Statement :-
Now add below statement at the top of CmsController :-
use Validator;
Check now validation is working fine. Now we will make it more secure by adding more options in validation.
6) Update contact function :-
We want to allow the user to add alphabets only and laravel provides alpha option but it will not allow spaces so we will search on net for better solution.
Search for the keyword like 'laravel validation for alphabetic characters and spaces' and open below stackoverflow link to find the solution.
https://stackoverflow.com/questions/34099777/laravel-5-1-validation-rule-alpha-cannot-take-whitespace
We will add regular expression for allowing alphabets with spaces as shown in video.
We can add other validation rules as well from Laravel website :-
https://laravel.com/docs/5.8/validation#available-validation-rules
Thanks for watching :)
Видео #115 Make E-com in Laravel 5.7 / 5.8 | Upgrade to Laravel 5.8 | Laravel Validations | Contact Form канала Stack Developers
Комментарии отсутствуют
Информация о видео
11 марта 2019 г. 16:58:13
00:22:34
Другие видео канала