Laravel Validation

Laravel provides several different approaches to validate your application’s incoming data.

Patrick Wan
2 min readFeb 20, 2022
Photo by Mohammad Rahmani on Unsplash

Laravel Validation is most common to use the validate method available on all incoming HTTP requests. However, we will discuss other approaches to validation as well.

Laravel includes a wide variety of convenient validation rules that you may apply to data, even providing the ability to validate if values are unique in a given database table. We’ll cover each of these validation rules in detail so that you are familiar with all of Laravel’s validation features.

Today we gonna show you how to use validation in Laravel. In oldest version of Laravel we are manually using validation function as the code below:

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
class ExampleController extend Controller { /*
* store new specific array in local storage
* @param \Illuminate\Http\Request Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request) {
$validate = Validator::make($request->all(), [ "username" => "required|unique",

--

--

Patrick Wan

My name’s Patrick. I’m a Software Developer, experience in Laravel, Vue Js, React Js, Livewire, Jquery, Codegniter, NPM, GIT. I have 5 years plus experience.