In my controller i was trying to update my product, product name here is unique and here i wanted to update only price. so name will be as it but as i defined name as a unique field though i haven't changed the name it throws me unique name validation error as this name already exist. How do i ignore that validation request when i don't update the unique value?
public function update(Request $request, $id)
{
$this->validate($request, [
'name'=> 'required|unique:products,'.$id,
]);
$product= Product::find($id);
$product->name = Input::get('name');
$product->price = Input::get('price');
$product->save();
}