define a column as unique in laravel validation code example
Example 1: set unique value validation for laravel form request
use Illuminate\Validation\Rule;
public function rules()
{
return [
'title' => [
'required',
Rule::unique('posts', 'title')->ignore($this->post)
]
];
}
Example 2: laravel unique validation on multiple columns
'mobile_no'
=> 'unique:users,mobile_no,NULL,id,country_id,'.request('country_id');