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

61 lines
1.4 KiB
PHP
Executable File

<?php
/**
* @createtime 2023/4/26
* @author wild
* @copyright PhpStorm
*/
namespace App\Model\Zq;
use App\Model\BaseModel;
class CtzqJqcMatch extends BaseModel
{
protected $appends = [
'home_odds',
'away_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 getHomeOddsAttribute($key)
{
return ['0', '1', '2', '3+'];
}
public function getAwayOddsAttribute($key)
{
return ['0', '1', '2', '3+'];
}
}