Calling unknown method: frontend\models\Post::addRule() не добавляет правило проверки, в чем причина?
Почему не найден метод?
use Yii;
use frontend\models\Post;
use yii\base\DynamicModel;
use yii\db\Query;
use yii\web\UploadedFile;
$maxSize = 2097152;
$extensions = 'jpeg, jpg, png, gif';
$model = new Post();
$post = Yii::$app->request->post();
$uploadParam = $post['field_model'];
$model->addRule($uploadParam, 'image', [
'maxSize' => $maxSize,
'extensions' => explode(', ', $extensions),
])->validate();