Welcome Guest, Not a member yet? Register   Sign In
is_unique rule doesn't work with softDeletes
#1

When using the is_unique rule for validation like so:

Code:
'rules'  => 'required|is_natural_no_zero|is_unique[teams.member_id]'

It works okay, unless you set $softDeletes = true in the model. Then it will find the soft-deleted record, and it won't pass validation.
Reply
#2

That is the way it is supposed to work. If you un-delete the original record, you now have a violation of table constraints, assuming you have set unique keys on that column.
Reply
#3

Ah yes of course, that makes sense. Thanks!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB