I am trying to create a custom validation rule in Laravel 4. I have tried registering the custom validation rule in the model, and also the start/global.php.
Here's my code for registering a new validation rule:
Validator::register('validate_login', function($attribute, $value, $parameters){
$password = Input::get('password');
$accountcount = DB::table('account')->where('account_email', '=', $value)->where('password','=',password_hash($password,PASSWORD_DEFAULT));
if ($accountcount!=1) return false;
return true;
});
As soon as I try to do things, I get this : Call to undefined method Illuminate\Validation\Factory::add_rule()
Is there anything else I need to do? Can someone please look into it and help me? thanks!