{"record":{"id":"ef62d0e78fb895d3","repo":"filamentphp/filament","slug":"the-model-tenantclass-does-not-have-a-relatio","errorCode":null,"errorMessage":"The model [{$tenantClass}] does not have a relationship named [{$relationshipName}]. You can change the relationship being used by setting it as the [$tenantRelationshipName] static property on the [{$resourceClass}] resource class.","messagePattern":"The model \\[(.+?)\\] does not have a relationship named \\[(.+?)\\]\\. You can change the relationship being used by setting it as the \\[\\$tenantRelationshipName\\] static property on the \\[(.+?)\\] resource class\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"packages/panels/src/Resources/Resource/Concerns/BelongsToTenant.php","lineNumber":121,"sourceCode":"    }\n\n    public static function getTenantRelationshipName(): string\n    {\n        return static::$tenantRelationshipName ?? (string) str(static::getModel())\n            ->classBasename()\n            ->pluralStudly()\n            ->camel();\n    }\n\n    public static function getTenantRelationship(Model $tenant): Relation\n    {\n        $relationshipName = static::getTenantRelationshipName();\n\n        if ($tenant->hasAttribute($relationshipName) || (! $tenant->isRelation($relationshipName))) {\n            $resourceClass = static::class;\n            $tenantClass = $tenant::class;\n\n            throw new LogicException(\"The model [{$tenantClass}] does not have a relationship named [{$relationshipName}]. You can change the relationship being used by setting it as the [\\$tenantRelationshipName] static property on the [{$resourceClass}] resource class.\");\n        }\n\n        return $tenant->{$relationshipName}();\n    }\n\n    public static function registerTenancyModelGlobalScope(Panel $panel): void\n    {\n        if (! static::isScopedToTenant()) {\n            return;\n        }\n\n        $model = static::getModel();\n\n        if (! class_exists($model)) {\n            return;\n        }\n\n        if ($model::hasGlobalScope($panel->getTenancyScopeName())) {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/filamentphp/filament/blob/53483fa9340e4ec637985fe454ebb58afb92ea24/packages/panels/src/Resources/Resource/Concerns/BelongsToTenant.php#L103-L139","documentation":"Error \"The model [{$tenantClass}] does not have a relationship named [{$relationshipName}]. You can change the relationship being used by setting it as the [$tenantRelationshipName] static property on the [{$resourceClass}] resource class.\" thrown in filamentphp/filament.","triggerScenarios":"Thrown at packages/panels/src/Resources/Resource/Concerns/BelongsToTenant.php:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"53483fa9340e4ec637985fe454ebb58afb92ea24","analyzedAt":"2026-08-17T02:06:23.049Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}