title: Laravel Eloquent model update according to condition of field value null or existing
body: <p>I am trying to update Laravel Eloquent model like this.</p>
  
  <pre><code>Res_Reservations::where('time_id', $time['id'])
                  -&gt;where('date',  $bus['date'])
                  -&gt;where('valid',  config('config.TYPE_SCHEDULE_UNREMOVED'))
                  -&gt;where(function($query) use($time, $notesAdd) {
                      $query-&gt;whereNull('reason', function($query) use ($time, $notesAdd) {
                          return $query-&gt;update([
                              'time_id' =&gt; $time['move'],
                              'reason' =&gt; $notesAdd
                          ]);
                      })
                      -&gt;orWhere('reason', '=', '', function($query) use ($time, $notesAdd) {
                          return $query-&gt;update([
                              'time_id' =&gt; $time['move'],
                              'reason' =&gt; $notesAdd
                          ]);
                      })
                      -&gt;orWhere('reason', '&lt;&gt;', '', function($query) use ($time, $notesAdd) {
                          return $query-&gt;update([
                              'time_id' =&gt; $time['move'],
                              'reason' =&gt; DB::raw("CONCAT(reason, \r\n'" . $notesAdd . "')")
                          ]);
                      });
                  });
  </code></pre>
  
  <p>But it does not working.</p>
  
  <p>In other words, I want to update as below.</p>
  
  <ul>
  <li><p>if 'reason' is null or emptystring</p>
  
  <pre><code>Res_Reservations::where('time_id', $time['id'])
                  -&gt;where('date',  $bus['date'])
                  -&gt;where('valid',  config('config.TYPE_SCHEDULE_UNREMOVED'))
                  -&gt;update([
                      'time_id' =&gt; $time['move'],
                      'reason' =&gt; $notesAdd
                  ]);
  </code></pre></li>
  <li><p>else </p>
  
  <pre><code>Res_Reservations::where('time_id', $time['id'])
                  -&gt;where('date',  $bus['date'])
                  -&gt;where('valid',  config('config.TYPE_SCHEDULE_UNREMOVED'))
                  -&gt;update([
                      'time_id' =&gt; $time['move'],
                      'reason' =&gt; DB::raw("CONCAT(reason, '\r\n" . $notesAdd . "')")
                  ]);
  </code></pre>
  
  <p>What is my mistake? And how can I make statements simpler? Please let me know~</p></li>
  </ul>