Пример #1
0
 /**
  * Update field value
  * @param  integer $id
  * @param  array   $data
  * @return boolean
  */
 public function update($id, $data)
 {
     // First validate the input
     if ($this->validation->passes($data)) {
         // Set the data
         $term = Term::find($id);
         $term->fill(array('title' => array_get($data, 'title'), 'body' => array_get($data, 'body'), 'image' => array_get($data, 'image')));
         // Slug
         if ($slug = array_get($data, 'slug') and $slug != $term->slug) {
             $term->slug = Str::slug($slug);
         }
         return $term->save();
     }
     // Set errors
     $this->errors = $this->validation->errors();
     return false;
 }