title: Laravel query with if condition
body: <p>I wanted to insert data into table if the condition is met. Is there such things as this codes below?</p>
  
  <pre><code>DB::table('food')-&gt;insert([
      'dessert' =&gt; $dessert1,
      if(beverage == 1)
          'drinks' =&gt; 1;
      else if(beverage == 2)
          'drinks' =&gt; 2;
  ]);
  ...
  </code></pre>