示例#1
0
文件: Page.php 项目: eozgilik/basalt
 public function validate()
 {
     $validator = new Validator();
     $validator->importRow('name', $this->name, ['IsNotEmpty'])->importRow('slug', $this->slug, ['IsNotEmpty', 'IsSlug'])->importRow('content', $this->content, ['IsNotEmpty'])->run();
     $errors = $validator->getErrors();
     if (false === empty($errors)) {
         throw new ValidationException($errors);
     }
 }
示例#2
0
文件: Page.php 项目: sthapa123/basalt
 public function validator()
 {
     $validator = new Validator();
     $validator->importRow('name', $this->name, ['IsNotEmpty'])->importRow('slug', $this->slug, ['IsNotEmpty', 'IsSlug'])->importRow('content', $this->content, ['IsNotEmpty'])->run();
     return $validator;
 }