Laravel 5.5 - Validation Data Return - New Feature
laravel released 5.5 version a few days ago and they also introduce several new feature. So in this post i will let you know one new feature, they provide new way to validation check using request() and validate().
In this post i will give you three way to check validation and store input data into variable. So let's simple see how we can check and return back to validation. so just check bellow way to check validation:
Example 1:
public function store()
{
$this->validate(request(), [
'name' => 'required',
'email' => 'required|email'
]);
return User::create(request()->all());
}
Example 2:
public function store()
{
$user = $this->validate(request(), [
'name' => 'required',
'email' => 'required|email'
]);
return User::create($user);
}
Example 3:
public function store()
{
$user = request()->validate([
'name' => 'required',
'email' => 'required|email'
]);
return User::create($user);
}
i hope it can help you....

My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Featured Post
- laravel 5.4 New Feature - Add eloquent whereKey method
- Laravel 5.3 - Form Input Validation rules example with demo
- Laravel 5.3 new feature and update - $loop variable
- Laravel 5 File(Image) Upload Example with Validation
- Laravel 5 client side validation using Parsley.js example
- Laravel 5 create Custom Validation Rule example.