Files
ProxyPanel/app/Http/Models/ReferralApply.php
兔姬桑 a0922521cf 初始化
2020-08-05 03:19:28 +08:00

59 lines
1.0 KiB
PHP

<?php
namespace App\Http\Models;
use Auth;
use Illuminate\Database\Eloquent\Model;
/**
* 返利申请
* Class ReferralApply
*
* @package App\Http\Models
* @mixin \Eloquent
*/
class ReferralApply extends Model
{
protected $table = 'referral_apply';
protected $primaryKey = 'id';
function scopeUid($query)
{
return $query->where('user_id', Auth::user()->id);
}
function User()
{
return $this->hasOne(User::class, 'id', 'user_id');
}
function getBeforeAttribute($value)
{
return $value / 100;
}
function setBeforeAttribute($value)
{
$this->attributes['before'] = $value * 100;
}
function getAfterAttribute($value)
{
return $value / 100;
}
function setAfterAttribute($value)
{
$this->attributes['after'] = $value * 100;
}
function getAmountAttribute($value)
{
return $value / 100;
}
function setAmountAttribute($value)
{
$this->attributes['amount'] = $value * 100;
}
}