title: is there a better way to write this if statement in laravel
body: <p>good day i am new in laravel and i am still learning as i go.</p>
  <p>my question is this code works but i feel like it unnecessary and can be written much better please can someone assist would a switch case be better or is there a better way to write this and please explain to me thank you.</p>
  <p>debtorscontroller.php</p>
  <pre><code>    $debtors_created_at = $debtors-&gt;created_at;
      $now = Carbon::now();
      $created_at_in_days = $debtors_created_at-&gt;diffInDays($now);
  
  
       if ($created_at_in_days &gt;= 0 and $created_at_in_days &lt;= 10){
  
           Debtor::whereId($debtorid)-&gt;update(['collection_level' =&gt; 'Pre Collection']);
       }elseif ($created_at_in_days &gt;= 11 and $created_at_in_days &lt;= 30){
  
              Debtor::whereId($debtorid)-&gt;update(['collection_level' =&gt; 'Collection Level 1']);
          }
       elseif ($created_at_in_days &gt;= 31 and $created_at_in_days &lt;= 60){
  
           Debtor::whereId($debtorid)-&gt;update(['collection_level' =&gt; 'Collection Level 2']);
       }
       elseif ($created_at_in_days &gt;= 61){
  
           Debtor::whereId($debtorid)-&gt;update(['collection_level' =&gt; 'Collection Level 3']);
       }
  </code></pre>
  <p>this just check wheter the debtor was created at and if it is 1-10 days old it changes</p>
  <p>its level</p>
  <p>days
  1-10 is pre collection
  11-30 is collection level 1
  31-60 is collection level 2
  61-90+ is collection level 3</p>
  <p>this is a field in my debtors table collection_level</p>