backend/controllers/MediaController.php
/**
     * Updates an existing Media model.
     * If update is successful, the browser will be redirected to the 'view' page.
     *
     * @param integer $id
     * @return mixed
     * @throws ForbiddenHttpException
     * @throws NotFoundHttpException
     */
Updates an existing Media model.
If update is successful, the browser will be redirected to the 'view' page.

@param integer $id
@return mixed
@throws ForbiddenHttpException
@throws NotFoundHttpException
Updates an existing Media model . If update is successful the browser will be redirected to the ' view ' page . @param integer $id @return mixed @throws ForbiddenHttpException @throws NotFoundHttpException
public function actionUpdate($id)
    {
        $model = $this->findModel($id);
        $this->getPermission($model);
        $metadata = $model->getMeta('metadata');
        if ($model->load(Yii::$app->request->post())) {
            $model->date = date('Y-m-d H:i:s', strtotime($model->date));
            if ($model->save()) {
                Yii::$app->getSession()->setFlash('success', Yii::t('writesdown', 'Media successfully saved.'));
                return $this->redirect(['update', 'id' => $id]);
            }
        }
        return $this->render('update', [
            'model' => $model,
            'metadata' => $metadata,
        ]);
    }
public function actionUpdate ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ this -> getPermission ( $ model ) ; $ metadata = $ model -> getMeta ( 'metadata' ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { $ model -> date = date ( 'Y-m-d H:i:s' , strtotime ( $ model -> date ) ) ; if ( $ model -> save ( ) ) { Yii :: $ app -> getSession ( ) -> setFlash ( 'success' , Yii :: t ( 'writesdown' , 'Media successfully saved.' ) ) ; return $ this -> redirect ( [ 'update' , 'id' => $ id ] ) ; } } return $ this -> render ( 'update' , [ 'model' => $ model , 'metadata' => $ metadata , ] ) ; }
Updates an existing Media model.
Updates an existing Media model .