public function actionCreate($type = null)
 {
     $model = new Template();
     $model->setScenario('create');
     if (isset($type)) {
         $model->type = $type;
     }
     if ($model->load(Yii::$app->request->post(), 'Template') && $model->validate()) {
         if (TemplateService::create($model)) {
             return $this->redirect($this->returnUrl);
         }
     }
     return $this->render('@cmsgears/module-core/admin/views/template/create', ['model' => $model]);
 }
 public static function findBySlugType($id, $type)
 {
     return Template::findBySlugType($id, $type);
 }
Beispiel #3
0
 public function getTemplate()
 {
     return $this->hasOne(Template::className(), ['id' => 'templateId']);
 }