title: Laravel: How do I autofocus an input field when there is/isn't an error in the var $error?
body: <p>If there is an error in a particular input, I want to highlight it and focus it, and it works as expected.</p>
  
  <p>However, if there are no errors (default case), the first input should focus, which it doesn't. How do I add these two options to the array? Take a look at the first form group.</p>
  
  <pre><code>&lt;div class="form-group {{ $errors-&gt;has('name') ? ' has-error' : '' }}"&gt;
      {{ Form::text('name', null, [
          (!$errors) ? 'autofocus' : '',        // if no errors, autofocus because default
          ($errors-&gt;has('name')) ? 'autofocus' : ''   // if error in name, autofocus
      ]) }}
  &lt;/div&gt;
  
  &lt;div class="form-group {{ $errors-&gt;has('email') ? ' has-error' : '' }}"&gt;
      {{ Form::email('email', null, [
          ($errors-&gt;has('email')) ? 'autofocus' : ''   // if error in email, autofocus
      ]) }}
  &lt;/div&gt;
  
  &lt;div class="form-group {{ $errors-&gt;has('password') ? ' has-error' : '' }}"&gt;
      {{ Form::password('password', [
          ($errors-&gt;has('password')) ? 'autofocus' : ''   // if error in password, autofocus
      ]) }}
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>