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

53 lines
1.0 KiB
PHP
Executable File

<?php
/**
* @createtime 2023/4/26
* @author wild
* @copyright PhpStorm
*/
namespace App\Model\Zq;
use App\Enums\SaleState;
use App\Model\BaseModel;
use App\Service\JingcaiLogoService;
class JczqGuanYaOdds extends BaseModel
{
protected $appends = [
'team_a_logo_url',
'team_b_logo_url',
'odds_state',
];
public function teama() {
return $this->belongsTo(ZqTeam::class, 'team_a_id', 'team_id');
}
public function teamb() {
return $this->belongsTo(ZqTeam::class, 'team_b_id', 'team_id');
}
public function getOddsStateAttribute()
{
return $this->order_state;
}
public function getTeamALogoUrlAttribute()
{
if (!$this->teama) {
return '';
}
return JingcaiLogoService::zqCountryLarge($this->teama->country);
}
public function getTeamBLogoUrlAttribute()
{
if (!$this->teamb) {
return '';
}
return JingcaiLogoService::zqCountryLarge($this->teamb->country);
}
}