53 lines
1.3 KiB
PHP
53 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace addons\webman\model;
|
|
|
|
use addons\webman\traits\HasDateTimeFormatter;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
/**
|
|
* Class Currency
|
|
* @property int id 主键
|
|
* @property string name 货币名称
|
|
* @property string identifying 货币标识
|
|
* @property float ratio 1货币-点数
|
|
* @property int status 状态
|
|
* @property int admin_id 管理员id
|
|
* @property string created_at 创建时间
|
|
* @property string updated_at 最后一次修改时间
|
|
* @property string deleted_at 删除时间
|
|
*
|
|
* @package addons\webman\model
|
|
*/
|
|
class Currency extends Model
|
|
{
|
|
use SoftDeletes, HasDateTimeFormatter;
|
|
public function __construct(array $attributes = [])
|
|
{
|
|
parent::__construct($attributes);
|
|
$this->setTable(plugin()->webman->config('database.currency_table'));
|
|
}
|
|
|
|
/**
|
|
* 游戏类别
|
|
* @return BelongsTo
|
|
*/
|
|
public function admin_user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(plugin()->webman->config('database.user_model'), 'admin_id');
|
|
}
|
|
|
|
/**
|
|
* 比值
|
|
*
|
|
* @param $value
|
|
* @return float
|
|
*/
|
|
public function getRatioAttribute($value): float
|
|
{
|
|
return floatval($value);
|
|
}
|
|
}
|