Beispiel #1
0
 public function updateCommodityStatistics($userId, $commodityId)
 {
     $statistics = CustomerCommodityStatistics::where('customer_id', $userId)->where('commodity_id', $commodityId)->first();
     if (!$statistics) {
         $statistics = new CustomerCommodityStatistics();
         $statistics->customer_id = $userId;
         $statistics->commodity_id = $commodityId;
         $statistics->count = 0;
     }
     /*if>*/
     $statistics->count += 1;
     $statistics->save();
 }