<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
//足球赛事
class Stzqcompetition extends Model
{
	protected $table = 'st_zq_competition';
	public $timestamps = false;

	// function resultlist(){
	// 	$data=$this->orderby('id','desc')->whereIn('status',array(1))->paginate(1);

 //        if(!$data){
 //            return -6010000122;
 //        }
 //        return $data->toArray();
	// }

	function resultlist($list = 10, $page, $where = '')
    {
        if (is_array ($where) && count ($where) > 0) {
            $data = $this->orderby('id','desc')->where($where)->paginate ($list);
        } else {
            $data = $this->orderby('id','desc')->where($where)->paginate ($list);
        }
        if (!$data < 0) {
            return -2021052003; //
        }
        return $data->toArray ();

	}
	
	//足球赛事联赛查询
	function allcompetition($lg_id){
		$data = $this->where('lg_id',$lg_id)->select('match_id','home_team','guest_team')->get();
        if (!$data) {
			return -5040000102; //无相关信息
		}
		return $data->toArray();
	}
	
}

?>