title: Laravel 8 "not required" validation rule
body: <p>how can I &quot;tell&quot; laravel that if the email field with validation rule 'email' and URL field (for example field where I expect the user to put his Facebook account link but that field IS NOT required) with validation rule 'URL' is not required and it is fine if it is empty. I have put nullable() on all database table columns but my validation rule still applies like it is required. Here are the parts of the code.</p>
  <p>This is from <strong>migration</strong>:</p>
  <pre><code>        $table-&gt;string('site_facebook')-&gt;nullable();
          $table-&gt;string('site_instagram')-&gt;nullable();
          $table-&gt;string('site_twitter')-&gt;nullable();
          $table-&gt;string('site_linkedin')-&gt;nullable();
          $table-&gt;string('site_behance')-&gt;nullable();
          $table-&gt;string('site_dribbble')-&gt;nullable();
          $table-&gt;string('site_email')-&gt;nullable();
  </code></pre>
  <p>This part is from <strong>validation</strong>:</p>
  <pre><code>        'site_facebook' =&gt; 'url',
          'site_facebook' =&gt; 'url',
          'site_instagram' =&gt; 'url',
          'site_twitter' =&gt; 'url',
          'site_linkedin' =&gt; 'url',
          'site_behance' =&gt; 'url',
          'site_dribbble' =&gt; 'url',
          'site_email' =&gt; 'email',
  </code></pre>
  <p>So, to wrap up my question. I want my URL and email fields to be optional not required :)</p>
  <p><strong>EDIT</strong></p>
  <p>Since there are some answers and no one work for me I just want to mention (if it does do anything with it), all of my validation rules are in a separate request...</p>
  <pre><code>    class ManageSiteSettingsRequest extends FormRequest
  {
      /**
       * 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 [
          'site_name' =&gt; 'required|max:50',
          'site_facebook' =&gt; 'nullable|url',
          'site_facebook' =&gt; 'url',
          'site_instagram' =&gt; 'url',
          'site_twitter' =&gt; 'url',
          'site_linkedin' =&gt; 'url',
          'site_behance' =&gt; 'url',
          'site_dribbble' =&gt; 'url',
          'site_email' =&gt; 'email',
          'site_creator_link' =&gt; 'url',
      ];
  }
  }
  </code></pre>
  <p>This is the form:</p>
  <pre><code>@extends('layouts.admin')
  </code></pre>
  <p>@section('content')</p>
  <pre><code>&lt;h2&gt;Site settings&lt;/h2&gt;
  
  @include('includes._errors')
  @include('includes._sessions')
  
  &lt;form action=&quot;{{ route('settings.update') }}&quot; method=&quot;post&quot;&gt;
      @csrf
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_name&quot;&gt;Site name&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_name&quot; class=&quot;form-control&quot; required placeholder=&quot;This field is required!&quot; value=&quot;{{ $settings-&gt;site_name }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_description&quot;&gt;Site description&lt;/label&gt;
          &lt;textarea name=&quot;site_description&quot; class=&quot;form-control mytinytext&quot; id=&quot;site_description&quot; cols=&quot;30&quot; rows=&quot;10&quot;&gt;{!! $settings-&gt;site_description !!}&lt;/textarea&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_facebook&quot;&gt;Site facebook page&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_facebook&quot; class=&quot;form-control&quot; placeholder=&quot;https://www.facebook.com/&quot; value=&quot;{{ $settings-&gt;site_facebook }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_instagram&quot;&gt;Site instagram page&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_instagram&quot; class=&quot;form-control&quot; placeholder=&quot;https://www.instagram.com/&quot; value=&quot;{{ $settings-&gt;instagram }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_twitter&quot;&gt;Site twitter page&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_twitter&quot; class=&quot;form-control&quot; placeholder=&quot;https://twitter.com/&quot; value=&quot;{{ $settings-&gt;site_twitter }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_linkedin&quot;&gt;Site linkedin page&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_linkedin&quot; class=&quot;form-control&quot; placeholder=&quot;https://www.linkedin.com/&quot; value=&quot;{{ $settings-&gt;site_linkedin }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_behance&quot;&gt;Site behance page&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_behance&quot; class=&quot;form-control&quot; placeholder=&quot;https://www.behance.net/&quot; value=&quot;{{ $settings-&gt;site_behance }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_dribbble&quot;&gt;Site dribbble page&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_dribbble&quot; class=&quot;form-control&quot; placeholder=&quot;https://dribbble.com/&quot; value=&quot;{{ $settings-&gt;site_dribbble }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_email&quot;&gt;Site email&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_email&quot; class=&quot;form-control&quot; placeholder=&quot;...@outlook... / ...@hotmail... / ...@gmail...&quot; value=&quot;{{ $settings-&gt;site_email }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;hr class=&quot;divider&quot;&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_field_one&quot;&gt;First footer field title&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_field_one&quot; class=&quot;form-control&quot; placeholder=&quot;PHONE&quot; value=&quot;{{ $settings-&gt;site_field_one }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_field_one_value&quot;&gt;First footer field value&lt;/label&gt;
          &lt;textarea name=&quot;site_field_one_value&quot; id=&quot;site_field_one_value&quot; class=&quot;mytinytext form-control&quot; placeholder=&quot;+80 (0)5 22 55 66 77&quot;&gt;{{ $settings-&gt;site_field_one_value }}&lt;/textarea&gt;
      &lt;/div&gt;
  
      &lt;hr class=&quot;divider&quot;&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_field_two&quot;&gt;Second footer field title&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_field_two&quot; class=&quot;form-control&quot; placeholder=&quot;ADDRESS&quot; value=&quot;{{ $settings-&gt;site_field_two }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_field_two_value&quot;&gt;Second footer field value&lt;/label&gt;
          &lt;textarea name=&quot;site_field_two_value&quot; id=&quot;site_field_two_value&quot; class=&quot;mytinytext form-control&quot; placeholder=&quot;33 rue Burdeau 69089, Paris France&quot;&gt;{{ $settings-&gt;site_field_two_value }}&lt;/textarea&gt;
      &lt;/div&gt;
  
      &lt;hr class=&quot;divider&quot;&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_field_three&quot;&gt;Third footer field title&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_field_three&quot; class=&quot;form-control&quot; placeholder=&quot;ENQUIRUES&quot; value=&quot;{{ $settings-&gt;site_field_three }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_field_three_value&quot;&gt;Third footer field value&lt;/label&gt;
          &lt;textarea name=&quot;site_field_three_value&quot; id=&quot;site_field_three_value&quot; class=&quot;mytinytext form-control&quot; placeholder=&quot;email@gmail.com&quot;&gt;{{ $settings-&gt;site_field_three_value }}&lt;/textarea&gt;
      &lt;/div&gt;
  
      &lt;hr class=&quot;divider&quot;&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_field_four&quot;&gt;Fourth footer field title&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_field_four&quot; class=&quot;form-control&quot; placeholder=&quot;WORK HOURS&quot; value=&quot;{{ $settings-&gt;site_field_four }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_field_four_value&quot;&gt;Fourth footer field value&lt;/label&gt;
          &lt;textarea name=&quot;site_field_four_value&quot; id=&quot;site_field_four_value&quot; class=&quot;mytinytext form-control&quot; placeholder=&quot;Weekdays: 09:00 - 18:00  Weekends: 11:00 - 17:00&quot;&gt;{{ $settings-&gt;site_field_four_value }}&lt;/textarea&gt;
      &lt;/div&gt;
  
      &lt;hr class=&quot;divider&quot;&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_copyright&quot;&gt;Site copyright&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_copyright&quot; class=&quot;form-control&quot; placeholder=&quot;Created with love by _______ (fill 'Site creator name' field)&quot; value=&quot;{{ $settings-&gt;site_copyright }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;hr class=&quot;divider&quot;&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_creator_name&quot;&gt;Site creator name&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_creator_name&quot; class=&quot;form-control&quot; placeholder=&quot;John Doe&quot; value=&quot;{{ $settings-&gt;site_creator_name }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;label for=&quot;site_creator_link&quot;&gt;Site creator page&lt;/label&gt;
          &lt;input type=&quot;text&quot; name=&quot;site_creator_link&quot; class=&quot;form-control&quot; placeholder=&quot;https://site-creator-page.com&quot; value=&quot;{{ $settings-&gt;site_creator_link }}&quot;&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-group&quot;&gt;
          &lt;button type=&quot;submit&quot; name=&quot;btn_update_site_settings&quot; class=&quot;btn btn-block btn-success&quot;&gt;Update site settings&lt;/button&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  
  @include('includes._errors')
  </code></pre>
  <p>@endsection</p>