Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Issues when combining filament-accounts and filament-saas-panel plugins #8

Open
Surovov opened this issue Jan 15, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Surovov
Copy link

Surovov commented Jan 15, 2025

What happened?

Hello,

I encountered multiple issues when combining the following two plugins:

\TomatoPHP\FilamentAccounts\FilamentAccountsPlugin::make()
    ->useImpersonate()
    ->impersonateRedirect('/app'),

\TomatoPHP\FilamentSaasPanel\FilamentSaasTeamsPlugin::make()
    ->allowAccountTeamTableAction()
    ->allowAccountTeamTableBulkAction()
    ->allowAccountTeamFilter()
    ->allowAccountTeamFormComponent()
    ->allowAccountTeamTableColumn(),

When I try to access the /admin/accounts page, I get the following error:

Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): 
Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, 
called in /var/www/erp.comingsoon.uz/vendor/filament/forms/src/Components/Select.php on line 767

How to reproduce the bug

  1. Installed the plugins in the following order: tomatophp/filament-accounts + tomatophp/filament-saas-panel
  2. Registered the plugins in FilamentPanelProvider as shown in the code snippet above.
  3. Attempted to access /admin/accounts.

Package Version

1

PHP Version

8.3

Laravel Version

11

Which operating systems does with happen with?

No response

Notes

No response

@Surovov Surovov added the bug Something isn't working label Jan 15, 2025
@Surovov
Copy link
Author

Surovov commented Jan 15, 2025

Observations:

  1. Full Plugin Registration
    When all FilamentSaasTeamsPlugin methods are enabled, I get the following error when navigating to /admin/accounts:
Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): 
Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, 
called in /Users/nobody1/Herd/Control/vendor/filament/forms/src/Components/Select.php on line 767

  1. Narrowing Down the Problem
    ->allowAccountTeamTableAction():
    Causes the following error when clicking the action button:
    Call to a member function pluck() on null

->allowAccountTeamFilter():
Causes the main error:

Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): 
Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, 
called in /Users/nobody1/Herd/Control/vendor/filament/forms/src/Components/Select.php on line 767

->allowAccountTeamTableColumn():
Causes the following error:

BadMethodCallException: Call to undefined method TomatoPHP\FilamentAccounts\Models\Account::teams()

->allowAccountTeamFormComponent():
Causes the following error:
Call to a member function getResults() on null

Possible Cause:
The issue seems to stem from the fact that FilamentSaasTeamsPlugin expects certain relationships or methods (teams, currentTeam, etc.) to be defined in the Account model. However, these relationships do not exist by default in the filament-accounts plugin.

It is also worth noting that I installed filament-accounts first and then added filament-saas-panel. This order of installation might have caused some misconfigurations or missing relationships.

Suggestions or Questions:

  1. Are there any specific relationships (teams, currentTeam, etc.) that I need to manually add to the Account model to make the plugins compatible?
  2. Should the order of installation for filament-accounts and filament-saas-panel matter?
  3. Could there be missing migrations or model changes required for the two plugins to integrate correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant