<?php

namespace App\Models;

class PcCao extends BaseModel
{
    protected $table = 'pc_cao';
    protected $fillable = ['field', 'val'];
    static function updateData(array $awards)
    {
        foreach ($awards as $field) {
            $cao = static::where('field', $field)->first();
            if (!$cao) {
                static::create([
                    'field' => $field,
                ]);
            }
            $cao->increment('val');
        }
    }
}