Exemplo n.º 1
0
 function create()
 {
     $model = new Cate();
     if ($this->isPost()) {
         $model->setAttributes($this->post('Cate'));
         if ($model->save()) {
             $this->redirect(url('/admin/cate'));
         }
     }
     $this->render('create', array('model' => $model));
 }
Exemplo n.º 2
0
 public function save()
 {
     if (!$this->validate()) {
         return false;
     }
     $model = new Cate();
     $model->setAttributes($this->getAttributes());
     !$model->pid && ($model->pid = 0);
     if (!$model->save()) {
         $this->addErrors($model->getErrors());
         return false;
     }
     return true;
 }