Advertisement
joris

Sample

Nov 14th, 2017
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. $post = Yii::$app->request->post();
  2.  
  3. $model = new DynamicModel(['mid' => null, 'email' => null]);
  4. $model->addRule(['mid', 'email'], 'required');
  5. $model->load($post);
  6. if($model->validate()) {
  7.     return ["message" => "Validation pass!"];
  8. } else {
  9.     return ["message" => "Validation fail. Please check your input!"];
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement