belongsTo(ApiKey::class, 'api_key_id'); } /** * 检查是否允许访问接口 */ public function canAccess($endpoint) { if ($this->isFullData()) { return true; } if ($endpoint === 'chuku') { return $this->allow_chuku == self::ALLOW_YES; } elseif ($endpoint === 'ruku') { return $this->allow_ruku == self::ALLOW_YES; } return false; } /** * 检查是否允许全量数据 */ public function isFullData() { return $this->allow_full_data == self::ALLOW_YES; } }