I've been experimenting with Laravel 4 recently and am trying to get a custom validation-class to work.
Validation-Class
<?php
class CountdownEventValidator extends Validator {
public function validateNotFalse($attribute, $value, $parameters) {
return $value != false;
}
public function validateTimezone($attribute, $value, $parameters) {
return !empty(Timezones::$timezones[$value]);
}
}
My rules are setup like this:
protected $rules = [
'title' => 'required',
'timezone' => 'timezone',
'date' => 'not_false',
'utc_date' => 'not_false'
];
I call the Validator inside my model like this:
$validation = CountdownEventValidator::make($this->attributes, $this->rules);
I get the following error:
BadMethodCallException
Method [validateTimezone] does not exist.
I've looked up quite a few tutorials but I couldn't find out what's wrong with my code.
Thank you for your help
Max