Unique customer |
I’m facing a small problem and hope CodeIgniter 4 has some build in way to handle this. I’m more then willing to write something myself, but rather use something internal if it’s available.
I have a inventory management system. When a product gets sold, we link it to a specific customer. I want to make sure that a specific customer is always unique, so you can’t accidentally add it twice. This means I have to check if the combination of a couple of values is unique in the database (so, not the individual values, but the combination of those values). Is there a build in validation filter to check this? I know about is_unique, but that’s for a specific value.
You would need to write your own validation filter for that.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(08-27-2021, 01:21 AM)BFlokstra Wrote: I’m facing a small problem and hope CodeIgniter 4 has some build in way to handle this. I’m more then willing to write something myself, but rather use something internal if it’s available. Sugesstion; From CI4's codehere you can create your own custom validation for 2 or more fields like this PHP Code: public function is_unique_2field(?string $str, string $field, array $data): bool |
Welcome Guest, Not a member yet? Register Sign In |