Ejemplo n.º 1
0
 public function actionCreate()
 {
     $model = new Town();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Ejemplo n.º 2
0
 public static function createTown($name, $status, $userId, $departmentId)
 {
     $town = new Town();
     $date = GeneralValues::getActualDate();
     $town->name = $name;
     $town->status = $status;
     $town->created_at = $date;
     $town->updated_at = $date;
     $town->fk_user_who_create = $userId;
     $town->fk_town_department = $departmentId;
     $town->save();
     return $town;
 }