PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, March 15, 2022

[FIXED] How to add unique mobile number by using Cakephp 3.x?

 March 15, 2022     cakephp, cakephp-3.0     No comments   

Issue

I know for email address, which is given below. so, suggest me for mobile number.

public function buildRules(RulesChecker $rules)
    {
         $rules->add($rules->isUnique(['email']));
        return $rules;
    }

Solution

You can just replicate what you've got for checking the email address is unique for the relevant mobile field. For example, if your field was phone:-

public function buildRules(RulesChecker $rules)
{
    $rules->add($rules->isUnique(['email']));
    $rules->add($rules->isUnique(['phone']));
    return $rules;
}

You can read more on validating unique fields in the official docs.



Answered By - drmonkeyninja
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing