Exemplo n.º 1
0
 /**
  * Creates a new StoryWorkplace model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new StoryWorkplace();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
Exemplo n.º 2
0
 /**
  * Deletes an existing WpOwners model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $workplace_id
  * @param integer $employee_id
  * @return mixed
  */
 public function actionDelete($workplace_id, $employee_id, $id_wp = 0)
 {
     $wp_owner = $this->findModel($workplace_id, $employee_id);
     if ($wp_owner->delete()) {
         $story = new StoryWorkplace();
         $story->id_wp = $workplace_id;
         $story->id_employee = $employee_id;
         $story->event = 0;
         $story->save();
     }
     if ($id_wp == 0) {
         return $this->redirect(['index']);
     } else {
         return $this->redirect(['workplaces/view', 'id' => $id_wp]);
     }
 }