示例#1
0
文件: Items.php 项目: deadem/djem
 public function __call($name, $args)
 {
     if (!preg_match('/^add/', $name)) {
         throw new BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $name);
     }
     $className = preg_replace('/^add/', '', $name);
     return $this->addControl(Controls\Item::createControl($className, $args));
 }
示例#2
0
文件: Control.php 项目: deadem/djem
 public function __construct($name = null)
 {
     parent::__construct($name);
     if ($name) {
         $this->name($name);
     }
     $this->bind = true;
 }
示例#3
0
文件: Editor.php 项目: deadem/djem
 private function addReversedSingleRelation(Controls\Item $item, $field)
 {
     $values = collect($item->getUserValue());
     $relation = $this->getRelation($field);
     $ids = $values->pluck('id')->filter(null);
     $relation->whereNotIn('id', $ids->all())->delete();
     $values->each(function ($value) use(&$relation) {
         $relation->save($value);
     });
 }