/** * Validates the supplied options * * @return void */ public function validateOptions() { //override the config $this->validator->override($this->suppliedOptions, $this->rules); //if the validator failed, throw an exception if ($this->validator->fails()) { throw new \InvalidArgumentException('There are problems with your ' . $this->suppliedOptions['name'] . ' config: ' . implode('. ', $this->validator->messages()->all())); } }
/** * Validates the supplied options * * @return void */ public function validateOptions() { //override the config $this->validator->override($this->suppliedOptions, $this->rules); //if the validator failed, throw an exception if ($this->validator->fails()) { throw new \InvalidArgumentException("There are problems with your '" . $this->suppliedOptions['action_name'] . "' action in the " . $this->config->getOption('name') . " model: " . implode('. ', $this->validator->messages()->all())); } }
/** * Validates the supplied data against the options rules * * @param array $data * @param array $rules * * @param mixed */ public function validateData(array $data, array $rules) { if ($rules) { $this->validator->override($data, $rules); //if the validator fails, kick back the errors if ($this->validator->fails()) { return implode('. ', $this->validator->messages()->all()); } } return true; }
/** * Create a new config Factory instance * * @param \Frozennode\Administrator\Validator $validator * @param array $options */ public function __construct(Validator $validator, array $options) { //set the config, and then validate it $this->options = $options; $this->validator = $validator; $validator->override($this->options, $this->rules); //if the validator failed, throw an exception if ($validator->fails()) { throw new \InvalidArgumentException('There are problems with your administrator.php config: ' . implode('. ', $validator->messages()->all())); } }