<?php
// +----------------------------------------------------------------------
// | saiadmin [ saiadmin快速开发框架 ]
// +----------------------------------------------------------------------
namespace app\dice\model\game;

use app\dice\model\DiceModel;

/**
 * 游戏管理模型
 *
 * dice_game 游戏配置表
 */
class DiceGame extends DiceModel
{
    protected $primaryKey = 'id';

    protected $table = 'dice_game';

    public $timestamps = true;

    public function searchProviderCodeAttr($query, $value): void
    {
        if ($value === '' || $value === null) {
            return;
        }
        $query->where('provider_code', '=', $value);
    }

    public function searchGameCodeAttr($query, $value): void
    {
        if ($value === '' || $value === null) {
            return;
        }
        $query->where('game_code', 'like', '%' . $value . '%');
    }

    public function searchGameTypeAttr($query, $value): void
    {
        if ($value === '' || $value === null) {
            return;
        }
        $query->where('game_type', '=', $value);
    }

    public function searchStatusAttr($query, $value): void
    {
        if ($value === '' || $value === null) {
            return;
        }
        $query->where('status', '=', $value);
    }
}
