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
Post a Comment