REST API in Laravel with CRUD functionality (2019) - How to Validate Request Data with Laravel

preview_player
Показать описание
In this video, you're gonna learn how to validate requests with Laravel.

For any API, request data must be validated to protect the API from invalid or malicious data. With Laravel, you easily do that with Laravel Requests.

Here we create a separate request file to validate each request data, and put all our validation rules there.

All available Laravel validation rules:

And we can define our own validation rules as well.

Once you're done with the Laravel Request file, Go the particular method in the controller and replace the default request class with the class you just created. Now the all requests coming to that particular route, will go through your Request file. So, they're validated and invalid data won't reach the database. Not even the controller.

So, that's how you can validate request data with Laravel.

This video is an episode of the tutorial series on Create REST API in Laravel with CRUD functionality (2019) :

Рекомендации по теме
Комментарии
Автор

You are truely a genius .
whole content was awesome.

sarwarsunjid
Автор

This was a nice introduction to Laravel API. Although I was already familiar with this, it ws a nice refresher. Excellent work!

TheSerphmx
Автор

Great course, good introductory and I learned alot

abdulia
Автор

hi brother, i try to use exclude_if but look what error i have : "message": "Method does not exist

cheekyfromparis
Автор

I completed the playlist .
i want to say thank you so much brother .
can i add this to git repository as my project ??

sarwarsunjid
Автор

how can i fetch all records like if we need all products whos price is 7000 using get or post method how can we get

mesajjadnadir