初始化
This commit is contained in:
52
addons/webman/model/Currency.php
Normal file
52
addons/webman/model/Currency.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user