예제 #1
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $path = Request::path();
     $id = explode("/", $path);
     $id = $id[count($id) - 1];
     return ['name' => 'required|unique:events,name,' . $id . ',id', 'timelineDate' => 'required', 'tags' => 'required'];
 }
예제 #2
0
 /**
  * Get the validation rules that apply to the request.
  * Dynamically apply rules based on what type of request is being made
  * 
  * @return array
  */
 public function rules()
 {
     switch (Request::path()) {
         case "login":
             $rules = ['name' => 'required|min:3|exists:users,name', 'password' => 'required|min:8|hashed'];
             break;
             // Default to registration requirements
         // Default to registration requirements
         default:
             $rules = ['name' => 'required|min:3|unique:users', 'email' => 'required|email|unique:users', 'password' => 'required|min:8|confirmed'];
             break;
     }
     return $rules;
 }
예제 #3
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $data = Input::all();
     $path = Request::path();
     $id = explode("/", $path);
     $id = $id[count($id) - 1];
     $required = array('name' => 'required|unique:media,name,' . $id . ',id', 'series' => 'required', 'collection' => 'required', 'medium' => 'required', 'timelineDate' => 'required');
     if ($data['series'] == 'newSeries') {
         $required['newSeriesName'] = 'required|unique:series,seriesName,' . $id . ',id';
         $required['newSeriesAbbr'] = 'required|not_in:newSeries|unique:series,seriesAbbreviation,' . $id . ',id';
     }
     if ($data['collection'] == 'newCollection') {
         $required['newCollectionName'] = 'required|not_in:newCollection';
     }
     if ($data['medium'] == 'newMedium') {
         $required['newMediumName'] = 'required|not_in:newMedium';
     }
     return $required;
 }