Beispiel #1
0
 public function saveElements($elements)
 {
     foreach ($elements as $k => $v) {
         if (DocketElement::where('element_id', $k)->count() > 0) {
             $el = DocketElement::where('element_id', $k)->first();
             if (!isset($v['prefill_value'])) {
                 $v['prefill_value'] = '';
             }
             $el->updateDetails($k, $v['type'], $v['y'], $v['x'], $v['width'], $v['height'], $v['prefill_value']);
         } else {
             if (!isset($v['prefill_value'])) {
                 $v['prefill_value'] = '';
             }
             $el = DocketElement::addNew($k, $v['type'], $v['y'], $v['x'], $v['width'], $v['height'], $v['prefill_value']);
             $this->elements()->save($el);
         }
     }
 }