laravel中验证requests唯一

laravel验证唯一

```
use Illuminate\Validation\Rule;
'catalog_name' => ['required', 'string','max:10', Rule::unique('sales_catalog')->ignore(request('id'))->where(function ($query) {
    $query->whereNotIn('id', [100]);
})],

'catalog_name' => ['required', 'string','max:10', Rule::exists('sales_catalog')->where(function ($query) {
    $query->whereNotIn('id', [100]);
})],
```

    A+
发布日期:2022年09月06日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: