• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.