title: Convert my DB raw to Laravel Eloquent model
body: <p>I have this code from a tutorial and i was wondering how can i convert it to laravel eloquent method because currently it is in DB raw method.</p>
  
  <pre><code>// $match = DiraChatLog::select(DB::raw("SUM(numberofview) as count"))
  //     -&gt;orderBy("created_at")
  //     -&gt;groupBy(DB::raw("year(created_at)"))
  //     -&gt;get()-&gt;toArray();
  // $match = array_column($match, 'count');
  
  // $missing = DiraChatLog::select(DB::raw("SUM(numberofclick) as count"))
  //     -&gt;orderBy("created_at")
  //     -&gt;groupBy(DB::raw("year(created_at)"))
  //     -&gt;get()-&gt;toArray();
  // $missing = array_column($missing, 'count');
  
  // $noAnswer = DiraChatLog::select(DB::raw("SUM(numberofclick) as count"))
  //     -&gt;orderBy("created_at")
  //     -&gt;groupBy(DB::raw("year(created_at)"))
  //     -&gt;get()-&gt;toArray();
  // $noAnswer = array_column($noAnswer, 'count');
  </code></pre>