<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;

class QuotaLog extends BaseModel
{
    use HasFactory;

    protected $table = "quota_log";


    public function orderInfo()
    {
        return $this->hasOne(Order::class, 'id', 'order_id');
    }

    public static function addQuotaLog($admin,$order_id,$num,$quota_id){
        $data = [
            'order_id' => $order_id,
            'quota_id' => $quota_id,
            'num' => $num,
            'operate_user_id' => $admin->id,
            'operate_user_name' => $admin->name
        ];
        self::create($data);
    }
}
