public function setInstance($instance) { parent::setInstance($instance); $this->all(function ($item) use($instance) { $item->setInstance($instance); }); return $this->instance($instance); }
public function getValidationRules() { $rules = parent::getValidationRules(); array_walk($rules, function (&$item) { if ($item == '_unique') { $table = $this->instance()->getTable(); $item = 'unique:' . $table . ',' . $this->attribute(); if ($this->instance()->exists()) { $item .= ',' . $this->instance()->getKey(); } } }); return [$this->path() => $rules]; }
public function getParams() { return parent::getParams() + ['value' => $this->values(), 'options' => $this->options()]; }