예제 #1
0
 public function update(array $data = [])
 {
     unset($data['_method'], $data['_token']);
     if (parent::update($data)) {
         unset($data['color']);
         if (Element::where('element_data_id', $this->id)->update($data)) {
             return true;
         }
     }
     return false;
 }
예제 #2
0
 public function search($input)
 {
     try {
         $elements = Element::where('name', 'LIKE', "%{$input}%")->get();
         if (empty($elements)) {
             throw new HttpException(404, "Container not found (by container identifier)");
         }
         return $elements;
     } catch (Exception $e) {
         echo 'Excepción capturada: ' . $e->getMessage(), "\n";
     }
 }