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]);
 }
示例#2
0
 public static function findBySlugType($id, $type)
 {
     return Template::findBySlugType($id, $type);
 }
示例#3
0
 public function getTemplate()
 {
     return $this->hasOne(Template::className(), ['id' => 'templateId']);
 }