is_unique rule doesn't work with softDeletes - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: is_unique rule doesn't work with softDeletes (/showthread.php?tid=76458) |
is_unique rule doesn't work with softDeletes - [email protected] - 05-14-2020 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. RE: is_unique rule doesn't work with softDeletes - kilishan - 05-14-2020 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. RE: is_unique rule doesn't work with softDeletes - [email protected] - 05-14-2020 Ah yes of course, that makes sense. Thanks! |