| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace App\Models\Mysql;
- class AgentBankInfoModel extends BaseMysql
- {
- /**
- * 表名
- * @var string
- */
- public $table = 'agent_bank_info';
- /**
- * UUID 键名
- * @var string
- */
- protected $uuidKeyName = 'uid';
- protected $appends = ['type_name'];
- /**
- * The "booted" method of the model.
- *
- * @return void
- */
- protected static function boot()
- {
- parent::boot();
- self::creating(function ($model) {
- $model->{$model->uuidKeyName} = self::generateId($model->uuidKeyName);
- });
- self::created(function ($model) {
- $uuid = hashEncodeId($model->id);
- $model->{$model->uuidKeyName} = $uuid;
- $model->save();
- });
- }
- public $typeMap = [
- 1 => '银行卡',
- 2 => 'USTD',
- 3 => '支付宝',
- ];
- /**
- * 获取提现方式
- *
- * @param $value
- * @return string
- */
- public function getTypeNameAttribute($value)
- {
- $name = $this->typeMap[$this->type] ?? '';
- return $this->type_name = $name;
- }
- }
|