示例#1
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     switch ($this->method) {
         case 'GET':
             break;
         case 'DELETE':
             break;
         case 'POST':
             return Brand::createRules();
         case 'PUT':
             break;
         case 'PATCH':
             return Brand::updateRules($this);
         default:
             break;
     }
     return [];
 }
示例#2
0
 /**
  * {@inheritdoc}.
  */
 protected function getValidator($model)
 {
     $data = $this->getModelAsArrayForDirtyAttributes($model);
     $updateRules = $this->getUpdateRulesForDirtyAttributes(Brand::updateRules($model));
     return Validator::make($data, $updateRules);
 }