controllers/AdminController.php
public function actionCreateImage($id)
    {
        $gallery = $this->findModel($id);

        $model = $this->module->manager->createGalleryImage(['scenario' => 'create']);

        $model->loadDefaultValues();

        if ($model->load(\Yii::$app->request->post())) {
            $model->gallery_id = $gallery->id;
            if($model->create()) {
                \Yii::$app->getSession()->setFlash('gallery.success', \Yii::t('gallery', 'Image has been created'));
                return $this->redirect(['images', 'id' => $id]);
            }
        }

        return $this->render('image/create', [
            'gallery' => $gallery,
            'model' => $model
        ]);
    }
public function actionCreateImage($id)
    {
        $gallery = $this->findModel($id);

        $model = $this->module->manager->createGalleryImage(['scenario' => 'create']);

        $model->loadDefaultValues();

        if ($model->load(\Yii::$app->request->post())) {
            $model->gallery_id = $gallery->id;
            if($model->create()) {
                \Yii::$app->getSession()->setFlash('gallery.success', \Yii::t('gallery', 'Image has been created'));
                return $this->redirect(['images', 'id' => $id]);
            }
        }

        return $this->render('image/create', [
            'gallery' => $gallery,
            'model' => $model
        ]);
    }
public function actionCreateImage ( $ id ) { $ gallery = $ this -> findModel ( $ id ) ; $ model = $ this -> module -> manager -> createGalleryImage ( [ 'scenario' => 'create' ] ) ; $ model -> loadDefaultValues ( ) ; if ( $ model -> load ( \ Yii :: $ app -> request -> post ( ) ) ) { $ model -> gallery_id = $ gallery -> id ; if ( $ model -> create ( ) ) { \ Yii :: $ app -> getSession ( ) -> setFlash ( 'gallery.success' , \ Yii :: t ( 'gallery' , 'Image has been created' ) ) ; return $ this -> redirect ( [ 'images' , 'id' => $ id ] ) ; } } return $ this -> render ( 'image/create' , [ 'gallery' => $ gallery , 'model' => $ model ] ) ; }
Create gallery image
@param $id Gallery id
@return string
@throws NotFoundHttpException
Create gallery image