I want to make a custom validation rule. My model looks like this at the moment:
protected $rules = array(
'first_name' => 'required',
'last_name' => 'required',
'ssn' => 'required|integer|min:4|max:4',
'email' => 'required|email',
'dob' => 'required|checkAge',
'phone' => 'required',
'street' => 'required',
'postal_code' => 'required|integer|min:4',
'city' => 'required'
);
But where I have to put the custom validation rule? I have read that I need to extend it Validator. For this I've created a simple function
Validator::extend('foo', function($attribute, $value, $parameters)
{
return $value == 'foo';
});
And I don't know where I have to check it?
Maybe someone can help me.
Thanks