jingcai-php/app/Model/Report/ReportDayWin.php

34 lines
787 B
PHP
Executable File

<?php
namespace App\Model\Report;
use App\Model\BaseModel;
use App\Model\Customer\Customer;
use App\Model\Lottery;
class ReportDayWin extends BaseModel
{
protected $appends = [
'cdate_show'
];
public function customer() {
return $this->belongsTo(Customer::class, 'customer_id', 'id');
}
public function lottery() {
return $this->belongsTo(Lottery::class, 'lottery_id', 'id');
}
public function getCdateShowAttribute() {
if (!$this->cdate) {
return '-';
}
if ($this->cdate == date('Ymd')) {
return '今日';
}
if ($this->cdate == date('Ymd', strtotime('-1 day'))) {
return '昨日';
}
return date('Y-m-d', strtotime($this->cdate));
}
}