belongsTo(Shop::class, 'shop_id', 'id'); } public function getStatusAttribute($value) { $map = [ 0 => '未授权', 1 => '已授权', 3 => '停用', ]; if (1 === (int)$value && ($this->attributes['expires_at'] - time()) / 3600 <= 72) { return '重新授权'; } return $map[$value]; } public function getExpiresAtAttribute($value) { return $value ? date('Y-m-d H:i:s', $value) : ''; } }