<?php

namespace App\Models;

class Cao extends BaseModel
{
    protected $table = 'cao';
    protected $fillable = ['field', 'val'];


    static function updateData(array $awards)
    {
        foreach ($awards as $field) {
            $cao = static::where('field', $field)->first();
            if (!$cao) {
                $cao = new Cao();
                $cao->field = $field;
                $cao->save();
            }
            $cao->increment('val');
        }
    }
}