Files
lotteryLaravel/app/Models/OddsItem.php

43 lines
970 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* {@see odds_items}
*
* `odds_value`:整数,**赔率乘数 × 10000**(例如 19500 表示 1.9500 倍)。
*/
class OddsItem extends Model
{
protected $fillable = [
'version_id',
'play_code',
'prize_scope',
'odds_value',
'rebate_rate',
'commission_rate',
'currency_code',
'extra_config_json',
];
protected function casts(): array
{
return [
'version_id' => 'integer',
'odds_value' => 'integer',
'rebate_rate' => 'decimal:4',
'commission_rate' => 'decimal:4',
'extra_config_json' => 'json',
];
}
/** @return BelongsTo<OddsVersion, OddsItem> */
public function version(): BelongsTo
{
return $this->belongsTo(OddsVersion::class, 'version_id');
}
}