<?php

namespace app\common\model;

use support\think\Model;

/**
 * GameChannel
 */
class GameChannel extends Model
{
    // 表名
    protected $name = 'game_channel';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    // 字段类型转换
    protected $type = [
        'create_time' => 'integer',
        'update_time' => 'integer',
    ];


    public function getprofitAmountAttr($value): ?float
    {
        return is_null($value) ? null : (float)$value;
    }

    public function adminGroup(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\AdminGroup::class, 'admin_group_id', 'id');
    }

    public function admin(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id', 'id');
    }
}