laravel required_if code example

Example 1: email validation in laravel

'email' => 'required|email|unique:users,email',
//@sujay

Example 2: laravel required if

"sale_price" => "required_if:list_type,==,selling"

Example 3: required_if laravel

public function rules()
 {
    return [
      'reclamo_procede'  => 'max:1',             
      'solucion_minutos' => 'required_if:reclamo_procede,==,si', 
    ];
 }

Example 4: email validation in laravel

$validator = Validator::make($request->all(), []);

 $validator->sometimes('email', 'unique:users,email', function ($input) {
            return $input->email !== Auth::user()->email;
        });
//@sujay