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) : ''; } public function getTypeAttribute($value) { $map = [ 'normal' => '电商标快', 'air' => '空运', ]; return $map[$value]; } public function senders() { return $this->hasMany(ShopSender::class, 'shop_ship_id'); } }