title: required_if Laravel 5 validation
body: <p>I have form that a user can fill-out for selling their home. And for one of the in puts, a user must select weather it will be "For Sale" or "For Rent". If it is For Sale, two price input fields will appear, and if it is For Rent, then some other price input field will appear based off of jQuery.</p>
  
  <p>My problem is I want the price fields to be required, BUT for example if I'am selecting "For Rent", and then I submit my form, it will give me an error saying the price fields for the "For Sale" input fields are required, even though it is under the "For Rent" section.</p>
  
  <p>I know there is a <em>required_if</em> in Laravel, but I just dont know how to utilize that. Here is my Requests for a Property.</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Requests;
  
  use App\Http\Requests\Request;
  
  class PropertyRequest extends Request
  {
      /**
       * Determine if the user is authorized to make this request.
       *
       * @return bool
       */
      public function authorize()
      {
          return true;
      }
  
      /**
       * Get the validation rules that apply to the request.
       *
       * @return array
       */
      public function rules()
      {
          return [
              'list_type' =&gt; 'required',
              'sale_price' =&gt; 'required', // &lt;-- maybe like: required_if:value
              'rent_price' =&gt; 'required',   
          ];
      }
  }
  </code></pre>
  
  <p>/****************** EDIT ***************************/</p>
  
  <p>What I have now:</p>
  
  <pre><code> public function rules()
      {
          return [
              'list_type'  =&gt; 'required',
              'sale_price' =&gt; 'required_if:list_type:For Sale',
              'rent_price' =&gt; 'required_if:list_type:For Rent',
      }
  </code></pre>
  
  <p>But I get this error when I submit the Form:</p>
  
  <p><a href="https://i.stack.imgur.com/CssNl.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/CssNl.jpg" alt="My Error"></a></p>