예제 #1
0
 /**
  * to update main model and multi-languages models by using multilang post
  *  
  * @param array $post post data
  * @param Illuminate\Database\Eloquent\Model $model
  * @param array $rules optional, you may want to add new rules
  * @return boolean
  */
 public function update(array $post, Model $model, array $rules = array())
 {
     if (!$this->checkdata($post, $model, $rules)) {
         return false;
     }
     if (!$model->exists) {
         throw new MultiLangModelWasNotFound('Model is not existed, therefore it can not updated!');
     }
     $this->setMainModel($model);
     // it will make the model to update later
     $this->updatedMainModel = $model;
     if (!$this->picker->isPostMultiLang()) {
         return $this->updateMainModel();
     }
     return $this->updateMainModel() && $this->updateLangModels();
 }
예제 #2
0
 public function testIsPostMultilang()
 {
     $this->obj->import($this->rawPost);
     $this->assertTrue($this->obj->isPostMultiLang());
 }