Thursday, March 16, 2017

How to validate rules in request for update? laravel 5

ProductRequest:

 public function rules()
    {
        return [
            //
            'name' => 'required|max:255',
            'category_id' => 'required|integer',
            'price' => 'required|min:500',
            'quantity' => 'required|integer|min:1',
            'details' => 'required',
            'description' => 'required',
            'additional' => 'required',
        ];
    }

But the problem is that only works when Im creating new product, when Im updating it and removing all fields, it doesn't trigger. How to validate these fields when Im updating product?



via Batmannn

Advertisement