Skip to content

Conversation

ustmaestro
Copy link

With this changes will automatically populate translation attributes

Now we can use default CRUD controllers actions without any changes:

public actionCreate()
{
    $model = new Post();
             if ($model->load(Yii::$app->request->post()) && $model->save()) 
    {
                 return $this->redirect(['view', 
            'id' => $model->id
        ]);
           } else {
                 return $this->render('create', [
                           'model' => $model,
                ]);
           }
}


public function actionUpdate($id)
    {
           $model = $this->findModel($id);
           if ($model->load(Yii::$app->request->post()) && $model->save())
           {
                 return $this->redirect(['view', 
            'id' => $model->id
        ]);
           } else {
                  return $this->render('update', [
                             'model' => $model,
                  ]);
           }
}

With this changes will automatically populate translation attributes

Now we can use default CRUD controllers actions without any changes:

	public actionCreate()
	{
		$model = new Post();
                 if ($model->load(Yii::$app->request->post()) && $model->save()) 
		{
                     return $this->redirect(['view', 
				'id' => $model->id
			]);
               } else {
                     return $this->render('create', [
                               'model' => $model,
                    ]);
               }
	}
	
	
	public function actionUpdate($id)
        {
               $model = $this->findModel($id);
               if ($model->load(Yii::$app->request->post()) && $model->save())
               {
                     return $this->redirect(['view', 
				'id' => $model->id
			]);
               } else {
                      return $this->render('update', [
                                 'model' => $model,
                      ]);
               }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant