コード例 #1
0
 public function validate()
 {
     $validator = App::make('validator');
     $rules = $this->processRules($this->model->validationRules);
     $this->validator = $validator->make($this->model->toArray(), $rules, $this->model->validationMessages);
     if ($this->validator->fails()) {
         $this->messageBag = $this->messageBag ? $this->messageBag->merge($this->validator->messages()) : $this->validator->messages();
         return false;
     }
     return true;
 }
コード例 #2
0
 public function toArray()
 {
     $results = parent::toArray();
     // only fire, if the actual model has image property
     if (isset($this->attributes['image']) and class_exists('photobanks_m')) {
         $results['image_dynamic'] = $this->image_dynamic;
     }
     return $results;
 }