/**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (Request::segment(3) == 'create') {
         $this->rules['file_name'] .= '|required';
     }
     return $this->rules;
 }
Beispiel #2
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     switch ($this->method()) {
         case 'POST':
             return ['email' => 'required|email|unique:users,email', 'first_name' => 'required', 'last_name' => 'required', 'password' => 'required'];
         case 'PUT':
         case 'PATCH':
             return ['email' => 'required|email|unique:users,email,' . Request::segment(2) . ',id', 'first_name' => 'required', 'last_name' => 'required'];
             break;
         default:
             break;
     }
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     switch ($this->method()) {
         case 'POST':
             return ['name' => 'required|unique:groups,name|max:50'];
         case 'PUT':
         case 'PATCH':
             return ['name' => 'required|unique:groups,name,' . Request::segment(2) . ',id'];
             break;
         default:
             break;
     }
 }