title: Laravel required_if not working
body: <p>My required_if validation does not work. No error is output when "doubles" is selected but "team_mate2 and opponent2" are not selected. I need the form to require a second team mate and opponent when doubles is selected as the match type.</p>
  
  <p><strong>Match.php (Model)</strong></p>
  
  <pre><code>&lt;?php
  
  class Match extends Eloquent{
  
      protected $table = 'matches';
  
      public static $rules = array(
          'match_type'=&gt;'required',
          'associate'=&gt;'alpha|min:2',
          'location'=&gt;'required|alpha|min:2',
          'opponent'=&gt;'numeric',
          'team_mate2'=&gt;'required_if:match_type,doubles',
          'opponent2'=&gt;'required_with:team_mate2'
      );
  
      public static $messages = array(
          'opponent.numeric'=&gt;'You must select a player.'
      );
  
  }
  </code></pre>
  
  <p><strong>MatchController.php</strong></p>
  
  <pre><code>public function postCreate()
  {
  
      $validator = Validator::make(Input::all(), Match::$rules, Match::$messages);
  
      if ($validator-&gt;passes()) 
      {
  
          $datetime = Input::get('year')."-".Input::get('month')."-".Input::get('day')." ".Input::get('time').":00";
  
          $match = new Match;
          $match-&gt;type = Input::get('match_type');
          $match-&gt;associate = Input::get('associate');
          $match-&gt;date = $datetime;
          $match-&gt;location = Input::get('location');
          $match-&gt;save();
  
          $matchp1 = new Matchplayer;
          $matchp1-&gt;user_id = Input::get('id');
          $matchp1-&gt;match_id = $match-&gt;id;
          $matchp1-&gt;team = 1;
          $matchp1-&gt;save();
  
          $matchp2 = new Matchplayer;
          $matchp2-&gt;user_id = Input::get('opponent');
          $matchp2-&gt;match_id = $match-&gt;id;
          $matchp2-&gt;team = 2;
          $matchp2-&gt;save();
  
          return Redirect::to('members/matches/create')-&gt;with('message', 'Match created!');
  
      }else{
          return Redirect::to('members/matches/create')-&gt;withErrors($validator)-&gt;withInput();
      }
  }
  </code></pre>
  
  <p><strong>Match Create View</strong></p>
  
  <pre><code>        {{ Form::open(array('url'=&gt;'members/matches/create', 'action' =&gt; 'post', 'class'=&gt;'form-horizontal')) }}
          {{ form::hidden('id', Auth::user()-&gt;id) }}
          &lt;div class="form-group"&gt;
              &lt;label class="col-sm-5 control-label col-sm-pad"&gt;Match Type&lt;/label&gt;
              &lt;div class="col-sm-7 col-sm-pad"&gt;
                  {{ $errors-&gt;first('match_type', '&lt;span class="help-block"&gt;:message&lt;/span&gt;') }}
                  {{ Form::select('match_type', array('singles' =&gt; 'Singles', 'doubles' =&gt; 'Doubles'), 'singles', array('id' =&gt; 'match_type', 'class' =&gt; 'form-control input')) }}
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="gender" class="col-sm-5 control-label col-sm-pad"&gt;League Associate&lt;/label&gt;
              &lt;div class="col-sm-7 col-sm-pad"&gt;
                  {{ $errors-&gt;first('associate', '&lt;span class="help-block"&gt;:message&lt;/span&gt;') }}
                  {{ Form::text('associate', Input::old('associate'), array('class' =&gt; 'form-control input')) }}
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label class="col-sm-5 control-label col-sm-pad"&gt;Team Mate #1&lt;br&gt;&lt;small&gt;&lt;/small&gt;&lt;/label&gt;
              &lt;div class="col-sm-7 col-sm-pad"&gt;
                  &lt;p class="form-control-static"&gt;{{ Auth::user()-&gt;first_name." ".Auth::user()-&gt;last_name }}&lt;/p&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group{{ $errors-&gt;first('opponent', ' has-error') }}"&gt;
              &lt;label class="col-sm-5 control-label col-sm-pad"&gt;Opponent #1&lt;/label&gt;
              &lt;div class="col-sm-7 col-sm-pad"&gt;
                  {{ Form::select('opponent', $users, 'key', array('class' =&gt; 'form-control input')) }}
                  {{ $errors-&gt;first('opponent', '&lt;span class="help-block"&gt;:message&lt;/span&gt;') }}
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group{{ $errors-&gt;first('team_mate2', ' has-error') }}"&gt;
              &lt;label class="col-sm-5 control-label col-sm-pad"&gt;Team Mate #2&lt;br&gt;&lt;small&gt;(Doubles Only)&lt;/small&gt;&lt;/label&gt;
              &lt;div class="col-sm-7 col-sm-pad"&gt;
                  {{ Form::select('team_mate2', $users, 'key', array('class' =&gt; 'form-control input')); }}
                  {{ $errors-&gt;first('team_mate2', '&lt;span class="help-block"&gt;:message&lt;/span&gt;') }}
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group{{ $errors-&gt;first('opponent2', ' has-error') }}"&gt;
              &lt;label class="col-sm-5 control-label col-sm-pad"&gt;Opponent #2&lt;br&gt;&lt;small&gt;(Doubles Only)&lt;/small&gt;&lt;/label&gt;
              &lt;div class="col-sm-7 col-sm-pad"&gt;
                  {{ Form::select('opponent2', $users, 'key', array('class' =&gt; 'form-control input')) }}
                  {{ $errors-&gt;first('opponent2', '&lt;span class="help-block"&gt;:message&lt;/span&gt;') }}
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label class="col-sm-5 control-label col-sm-pad"&gt;Date&lt;/label&gt;
                  {{ $errors-&gt;first('day', '&lt;span class="help-block"&gt;:message&lt;/span&gt;') }}
                  &lt;div class="col-lg-2 col-sm-pad"&gt;
                      {{ Form::selectRange('day', 1, 31, 'a', array('class' =&gt; 'form-control input input-sm dob-form-control')) }}
                  &lt;/div&gt;
                  &lt;div class="col-lg-2 col-sm-pad"&gt;
                      {{ Form::selectRange('month', 1, 12, 'a', array('class' =&gt; 'form-control input input-sm dob-form-control')) }}
                  &lt;/div&gt;
                  &lt;div class="col-lg-3 col-sm-pad"&gt;
                      {{ Form::selectRange('year', 2014, 2015, 'a', array('class' =&gt; 'form-control input-sm input dob-form-control')) }}
                  &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group"&gt;
              &lt;label class="col-sm-5 control-label col-sm-pad"&gt;Time&lt;/label&gt;
              &lt;div class="col-lg-3 col-sm-pad"&gt;
                  {{ Form::select('time', $times, 'key', array('class' =&gt; 'form-control input input-sm dob-form-control')) }}
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="form-group{{ $errors-&gt;first('location', ' has-error') }}"&gt;
              &lt;label class="col-sm-5 control-label col-sm-pad"&gt;Location&lt;/label&gt;
              &lt;div class="col-sm-7 col-sm-pad"&gt;
                  {{ Form::text('location', Input::old('location'), array('class' =&gt; 'form-control input')) }}
                  {{ $errors-&gt;first('location', '&lt;span class="help-block has-error"&gt;:message&lt;/span&gt;') }}
              &lt;/div&gt;
          &lt;/div&gt;
          {{ Form::submit('Create', array('class'=&gt;'btn btn-success btn-block')) }}
          {{ Form::token() . Form::close() }}
  </code></pre>