Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $post = Yii::$app->request->post();
- $model = new DynamicModel(['mid' => null, 'email' => null]);
- $model->addRule(['mid', 'email'], 'required');
- $model->load($post);
- if($model->validate()) {
- return ["message" => "Validation pass!"];
- } else {
- return ["message" => "Validation fail. Please check your input!"];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement