php - how to add custom username available and email available methods as rules in kohana -


What is the correct format to add rules to check unique username and email in Kochi 3.3 < P> I have follow-up

  array (Array ($ $, 'unique'), array ('username', ': value')); // Like the email has been added ('username', array ('unique_username', 'array' (': value')); / / / Added as well as email, public static work unique_username ($ username) {echo 'Running'; // Check that the database returns if the user name already exists! DB :: select (array (DB :: expr ('COUNT (username)' ('user') -> where ('username' , '=', $ Username)) -> execute () -> Get ('total');}   

I get the following error

Log 3 to Kohana_Validation :: rule () An array passed, string given

I can not give you an exact answer because You do not show your class name. For example, if your class was named Model_User here, here's how you would use a static method as a statutory callback:

-> Rule ('Username', 'Model_User :: unique_username', array (': value'));

or

-> Rule ('username', array ('model_use', 'unique_namename'), array (': value'));

Comments

Popular posts from this blog

jasper reports - How to center align barcode using jasperreports and barcode4j -

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -