コード例 #1
0
 /**
  * @param $articleType
  */
 public function updateArticleStatistics($articleTypeId)
 {
     $date = Carbon::now()->toDateString();
     $statistics = EnterpriseArticleStatistics::where('date', $date)->where('article_type_id', $articleTypeId)->first();
     if (!$statistics) {
         $statistics = new EnterpriseArticleStatistics();
         $statistics->article_type_id = $articleTypeId;
         $statistics->date = $date;
         $statistics->count = 0;
     }
     /*if>*/
     $statistics->count += 1;
     $statistics->save();
 }