filamentphp/filament · error · LogicException

The model [{$tenantClass}] does not have a relationship name

Error message

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.

What it means

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.

Source

Thrown at packages/panels/src/Resources/Resource/Concerns/BelongsToTenant.php:121

    }

    public static function getTenantRelationshipName(): string
    {
        return static::$tenantRelationshipName ?? (string) str(static::getModel())
            ->classBasename()
            ->pluralStudly()
            ->camel();
    }

    public static function getTenantRelationship(Model $tenant): Relation
    {
        $relationshipName = static::getTenantRelationshipName();

        if ($tenant->hasAttribute($relationshipName) || (! $tenant->isRelation($relationshipName))) {
            $resourceClass = static::class;
            $tenantClass = $tenant::class;

            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.");
        }

        return $tenant->{$relationshipName}();
    }

    public static function registerTenancyModelGlobalScope(Panel $panel): void
    {
        if (! static::isScopedToTenant()) {
            return;
        }

        $model = static::getModel();

        if (! class_exists($model)) {
            return;
        }

        if ($model::hasGlobalScope($panel->getTenancyScopeName())) {

View on GitHub (pinned to 53483fa934)

When it happens

Trigger: Thrown at packages/panels/src/Resources/Resource/Concerns/BelongsToTenant.php:121 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of filamentphp/filament@53483fa934 (2026-08-17). Data as JSON: /api/errors/ef62d0e78fb895d3. Report an issue: GitHub.