Laravel 5.4 sometimes validation rules not working : <p>I am trying to validate a date field only if it is present. It was working fine before I upgraded from Laravel 5.2 to 5.4</p>

<p>In Laravel 5.2 this rules works fine:</p>

<pre><code>public function rules()
{
    return [
        'available_from' =&gt; 'date',
    ];

}
</code></pre>

<p>In 5.4 it returns validation error <code>The available from is not a valid date.</code> I tried this new rules</p>

<pre><code>public function rules()
{
    return [
        'available_from' =&gt; 'sometimes|date',
    ];

}
</code></pre>

<p>Still got the same error and seems the <code>sometimes</code> rules not affecting the validation at all. How can I get rid of this error?</p>

<p>I don't understand why Laravel changed something that was working before!!!</p>
