Your class will need a validate method as specified by @validate.
public function validate($attribute, $value, $parameters)
{
return $value == 'foo';
}
I did have a validate method. But I did not have the same method signature. Thank you!
For those looking to access data from the whole model which is being validated, inside your validation method (shown above), you can access a forth parameter passed to your method ($validationModel):
public function validate($attribute, $value, $parameters, $validationModel)
{
var_dump($validationModel->getData());
// Logic here
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community