57 lines
1.0 KiB
PHP
57 lines
1.0 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 文件功能:赛马竞猜下注记录模型
|
||
|
|
*
|
||
|
|
* 记录用户在每场赛马中的下注信息、押注马匹、结果和赔付金额。
|
||
|
|
*
|
||
|
|
* @author ChatRoom Laravel
|
||
|
|
*
|
||
|
|
* @version 1.0.0
|
||
|
|
*/
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class HorseBet extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'race_id',
|
||
|
|
'user_id',
|
||
|
|
'horse_id',
|
||
|
|
'amount',
|
||
|
|
'status',
|
||
|
|
'payout',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 属性类型转换。
|
||
|
|
*/
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'horse_id' => 'integer',
|
||
|
|
'amount' => 'integer',
|
||
|
|
'payout' => 'integer',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 所属场次。
|
||
|
|
*/
|
||
|
|
public function race(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(HorseRace::class, 'race_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 下注用户。
|
||
|
|
*/
|
||
|
|
public function user(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(User::class);
|
||
|
|
}
|
||
|
|
}
|