How to filter soft deleted data in laravel's unique verification
阿神
阿神 2017-05-16 16:48:14
0
1
656

It is a field unique verification, in addition to itself, there are soft deleted records

阿神
阿神

闭关修行中......

reply all(1)
某草草

Use the following method

'email' => Rule::unique('users')->where(function ($query) {
    $query->whereNotNull('deleted_at')->whereNot('id', 4);
})

Refer to the official documentation https://laravel.com/docs/5.4/...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!