laravel unique except, some operation on query code example
Example: laravel unique except, some operation on query
public function rules()
{
return [
'name' => [
'required',
'email',
Rule::unique('users', 'email')
->where(static function ($query) {
return $query->whereNull('deleted_at');
})
->ignore($this->user),
]
];
}