S
S
sowich2013-07-03 12:19:47
Kohana
sowich, 2013-07-03 12:19:47

Is it possible in Kohana to disable a rule in the model for a specific action?

Sobsno subject, Yii allows this, is it implemented in Kohana?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Balobanov, 2013-07-03
@sowich

When processing the form in the controller, simply delete the rule in the text field from the rules array.

A
Andrew Emelianenko, 2013-07-05
@YourWest

Please write how you solved this problem. Others, I think, will also be interesting.
In general, everything is done very simply:

     public function rules()
     {

    $rules = array(
      // здесь все наши правила без правила для "text"
    );

    if (Auth::instance()->logged_in('moderator'))
    {
      $rules['text'] = array(
        array('not_empty'),
      );
    }

        return $rules;
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question