jingcai-php/app/Model/Zq/CtzqSfcMatch.php

55 lines
1.3 KiB
PHP
Executable File

<?php
/**
* @createtime 2023/4/26
* @author wild
* @copyright PhpStorm
*/
namespace App\Model\Zq;
use App\Model\BaseModel;
class CtzqSfcMatch extends BaseModel
{
protected $appends = [
'odds'
];
public function match() {
return $this->belongsTo(ZqMatch::class, 'match_id', 'match_id');
}
public function getJcHomeTeamNameAttribute() {
if ($this->is_reverse == 1) {
return $this->attributes['jc_away_team_name'];
}
return $this->attributes['jc_home_team_name'];
}
public function getJcHomeTeamNameFullAttribute() {
if ($this->is_reverse == 1) {
return $this->attributes['jc_away_team_name_full'];
}
return $this->attributes['jc_home_team_name_full'];
}
public function getJcAwayTeamNameAttribute() {
if ($this->is_reverse == 1) {
return $this->attributes['jc_home_team_name'];
}
return $this->attributes['jc_away_team_name'];
}
public function getJcAwayTeamNameFullAttribute() {
if ($this->is_reverse == 1) {
return $this->attributes['jc_home_team_name_full'];
}
return $this->attributes['jc_away_team_name_full'];
}
public function getOddsAttribute($key)
{
return ['3', '1', '0'];
}
}