| 123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\SoftDeletes;
- class RechargeChannelGroup extends BaseModel
- {
- use SoftDeletes;
- protected $table = 'recharge_channel_group';
- protected $fillable = ['name', 'recharge_type', 'withdraw_type'];
- // activity_type 列已停用(原按层级开关活动),不再返回
- protected $hidden = ['activity_type'];
- // 修改器:将逗号分隔字符串转为数组
- public function getRechargeTypeAttribute($value)
- {
- return $value ? explode(',', $value) : [];
- }
- // 设置器:将数组转为逗号分隔字符串
- public function setRechargeTypeAttribute($value)
- {
- $this->attributes['recharge_type'] = is_array($value) ? implode(',', $value) : $value;
- }
- public function getWithdrawTypeAttribute($value)
- {
- return $value ? explode(',', $value) : [];
- }
- public function setWithdrawTypeAttribute($value)
- {
- $this->attributes['withdraw_type'] = is_array($value) ? implode(',', $value) : $value;
- }
- }
|