title: Laravel only update if not null
body: <p>Is there a way of condensing the following code into a single <code>update()</code>?:</p>
  
  <pre><code>    $this-&gt;validate(request(), [
          'name' =&gt; 'required|string|max:255',
          'email' =&gt; 'required|string|email|max:255|unique:users,email,'.$id,
          'password' =&gt; 'nullable|string|min:6|confirmed',
          'timezone' =&gt; 'required|timezone',
      ]);
  
      $user = User::findOrFail($id);
      $user-&gt;update(request()-&gt;all());
      if (!empty(request()-&gt;input('password'))) {
          $user-&gt;update(['password' =&gt; bcrypt(request()-&gt;input('password'))]);
      }
  </code></pre>
  
  <p>I want to get rid of the conditional statement for updating the password because I am using a mutator to <code>bcrypt</code> it automatically now. Is there a method like <code>request()-&gt;allNotNull()</code>?</p>