/** * @param \Illuminate\Database\Eloquent\Model $model * @param \anlutro\LaravelValidation\ValidatorInterface $validator */ public function __construct(Model $model, ValidatorInterface $validator = null) { parent::__construct($validator); $this->model = $model; if ($validator) { $validator->replace('table', $this->model->getTable()); } }
/** * @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); } }