Exemple #1
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     $result = ArrayHelper::merge(parent::rules(), [[['image'], 'image', 'extensions' => Yii::$app->preview->supportedExtensions, 'minWidth' => 100, 'maxWidth' => 2000, 'maxSize' => 1048576]]);
     if ($this->getIsNewRecord()) {
         $result[] = [['image'], 'required'];
     }
     return $result;
 }
Exemple #2
0
 public function rules()
 {
     $rules = [['dateFrom', 'date', 'timestampAttribute' => 'dateFromTimestamp'], ['dateTo', 'date', 'timestampAttribute' => 'dateToTimestamp']];
     return ArrayHelper::merge($rules, parent::rules());
 }