Пример #1
0
 /**
  * @param Newsletter $newsletter
  * @return Newsletter
  */
 public static function create($newsletter)
 {
     // Create Newsletter
     $newsletter->save();
     // Return Newsletter
     return $newsletter;
 }
Пример #2
0
 public function actionCreate()
 {
     $model = new Newsletter();
     $model->setScenario("create");
     if ($model->load(Yii::$app->request->post(), "Newsletter") && $model->validate()) {
         if (NewsletterService::create($model)) {
             $this->redirect(["all"]);
         }
     }
     return $this->render('create', ['model' => $model]);
 }