{"record":{"id":"9ffa2d1f9e717edc","repo":"filamentphp/filament","slug":"the-model-recordclass-does-not-have-a-relatio","errorCode":null,"errorMessage":"The model [{$recordClass}] does not have a relationship named [{$relationshipName}]. You can change the relationship being used by passing it to the [ownershipRelationship] argument of the [tenant()] method in configuration. You can change the relationship being used per-resource by setting it as the [$tenantOwnershipRelationshipName] static property on the [{$resourceClass}] resource class.","messagePattern":"The model \\[(.+?)\\] does not have a relationship named \\[(.+?)\\]\\. You can change the relationship being used by passing it to the \\[ownershipRelationship\\] argument of the \\[tenant\\(\\)\\] method in configuration\\. You can change the relationship being used per-resource by setting it as the \\[\\$tenantOwnershipRelationshipName\\] static property on the \\[(.+?)\\] resource class\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"packages/panels/src/Resources/Resource/Concerns/BelongsToTenant.php","lineNumber":99,"sourceCode":"    public static function isScopedToTenant(): bool\n    {\n        return static::$isScopedToTenant;\n    }\n\n    public static function getTenantOwnershipRelationshipName(): string\n    {\n        return static::$tenantOwnershipRelationshipName ?? Filament::getTenantOwnershipRelationshipName();\n    }\n\n    public static function getTenantOwnershipRelationship(Model $record): Relation\n    {\n        $relationshipName = static::getTenantOwnershipRelationshipName();\n\n        if ($record->hasAttribute($relationshipName) || (! $record->isRelation($relationshipName))) {\n            $resourceClass = static::class;\n            $recordClass = $record::class;\n\n            throw new LogicException(\"The model [{$recordClass}] does not have a relationship named [{$relationshipName}]. You can change the relationship being used by passing it to the [ownershipRelationship] argument of the [tenant()] method in configuration. You can change the relationship being used per-resource by setting it as the [\\$tenantOwnershipRelationshipName] static property on the [{$resourceClass}] resource class.\");\n        }\n\n        return $record->{$relationshipName}();\n    }\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))) {","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/filamentphp/filament/blob/53483fa9340e4ec637985fe454ebb58afb92ea24/packages/panels/src/Resources/Resource/Concerns/BelongsToTenant.php#L81-L117","documentation":"Error \"The model [{$recordClass}] does not have a relationship named [{$relationshipName}]. You can change the relationship being used by passing it to the [ownershipRelationship] argument of the [tenant()] method in configuration. You can change the relationship being used per-resource by setting it as the [$tenantOwnershipRelationshipName] static property on the [{$resourceClass}] resource class.\" thrown in filamentphp/filament.","triggerScenarios":"Thrown at packages/panels/src/Resources/Resource/Concerns/BelongsToTenant.php:99 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"}