• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is_unique rule doesn't work with softDeletes

When using the is_unique rule for validation like so:

'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.

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.

Ah yes of course, that makes sense. Thanks!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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