Extending Validation Class fuelphp?

278 Views Asked by At

Fuelphp Extending Validation classes link
http://fuelphp.com/docs/classes/validation/validation.html#rules

Hi guys

I am facing a very critical problem for Extending Validation classes. Can anyone suggest a solution to me, and how the step is done, as well as how can perform it ????

This is the way I done it

Screenshot of Image 1

I try to add class at path(fuel/app/myrules) with below class

<?php
class MyRules
{
    // note this is a non-static method
    public function _validation_is_upper($val)
    {
    return $val === strtoupper($val);
    }

}
?>

Image 2

Next at the controller, adding this for call

  $val = Validation::forge();
  $val->add_model('_validation_is_upper');

but nothing happens.

The fuelphp document is incomplete.

1

There are 1 best solutions below

2
On
$val = Validation::forge();
$val->add_callable(new MyRules());