/** * {@inheritdoc} */ public function update($model, array $attributes) { if (!$model->exists) { throw new \RuntimeException('Cannot update non-existant model'); } return parent::update($model, $attributes); }
/** * @param \Illuminate\Database\Connection $db * @param \anlutro\LaravelValidation\ValidatorInterface $validator */ public function __construct(Connection $db, ValidatorInterface $validator = null) { if ($this->table === null) { $class = get_class($this); throw new \RuntimeException("Property {$class}::\$table must be defined."); } parent::__construct($validator); $this->setConnection($db); if ($validator) { $validator->replace('table', $this->table); } }