UpdateLog.php 806 字节
<?php

namespace App\Models\Com;

use Illuminate\Database\Eloquent\Model;

class UpdateLog extends Model
{
    //设置关联表名
    protected $table = 'gl_update_log';

    const STATUS_PENDING = 0;
    const STATUS_SUCCESS = 1;
    const STATUS_FAIL = 2;

    /**
     * 创建更新日志
     * @param $type
     * @param $project_id
     * @param $type
     * @param $url
     * @return mixed
     */
    public static function createLog($project_id, $type, $url)
    {
        $log = self::where('project_id', $project_id)->where('api_type', $type)->first();
        if (!$log) {
            $log = new self();
            $log->project_id = $project_id;
            $log->api_type = $type;
            $log->api_url = $url;
            return $log->save();
        }
        return true;
    }
}