<?php
namespace App\Http\Model;

use Illuminate\Database\Eloquent\Model;
use App\Lib\Biz\Sport\Common as commonFunction;


/**
 * Class Account
 * @package App\Sports\Model
 * 用户账号
 */
class St_odds_code extends Model
{
    protected $table = 'st_odds_code';
    public $timestamps = false;

    /**
     * 获取指定 球类 的所有指定 玩法
     */
    public function getOddsCode($game_code=''){
        //获取各球类父级代码
        $p_code = commonFunction::getOddsPcode($game_code);
        //获取父级玩法 id
        $p_id_arr = $this->where(['game_code'=>$game_code])->whereIn('odds_code',$p_code)->select('id')->get()->toArray();
        $p_ids = array_column($p_id_arr,'id');

        $oddsCode = $this->whereIn('p_id',$p_ids)->select('odds_code','odds_name')->get()->toArray();

        return $oddsCode;

    }


}