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

access app cluster from plugin class #12532

Closed
atmonshi opened this issue Apr 28, 2024 · 3 comments
Closed

access app cluster from plugin class #12532

atmonshi opened this issue Apr 28, 2024 · 3 comments
Labels
bug Something isn't working low priority unconfirmed
Milestone

Comments

@atmonshi
Copy link
Contributor

Package

filament/filament

Package Version

v3.2.72

Laravel Version

v11.5.0

Livewire Version

v3.4.11

PHP Version

v8.2.10

Problem description

from a plugin class, trying to allow users to set the plugin resource in a cluster

the Reproduction repository already configured to use CuratorPlugin
and there is a cluster in the app Life::class

when using the plugin like:

\Awcodes\Curator\CuratorPlugin::make()
    ->cluster(Life::class)

in the plugin resource:

public static function getCluster(): ?string
{
    return CuratorPlugin::get()->getCluster();
}

you'll see the error
Call to a member function getPlugin() on null

its look like the clusters not ready when the plugin initialized?!

Expected behavior

when accessing the cluster from a config

public static function getCluster(): ?string
    {
        return config('curator.resources.cluster');
    }

it works fin, but not if it set from the class CuratorPlugin

btw the CuratorPlugin was an example, tested with other of my packages got the same error.

Steps to reproduce

the Reproduction repository already setup with a cluster and the plugin installed and configerd

using a fork of the plugin:
https://github.com/atmonshi/filament-curator/tree/cluster-panel

when accessing the /admin you will get the error Call to a member function getPlugin() on null

disable this
https://github.com/atmonshi/filament-curator/blob/669af3898dbc74e1dd3803d13c67e9d98b338981/src/Resources/MediaResource.php#L69

to make it work

Reproduction repository

https://github.com/atmonshi/issue-cluster

Relevant log output

No response

@atmonshi atmonshi added bug Something isn't working low priority unconfirmed labels Apr 28, 2024
@atmonshi atmonshi changed the title access app cluster from plugin provider access app cluster from plugin class Apr 28, 2024
@dmitry-udod
Copy link
Contributor

@atmonshi Hi! It seems you are trying to use your custom repository plugin.

https://github.com/atmonshi/issue-cluster/blob/main/composer.json#L72

I tried to install plugin from official repo and everything works fine. You need to find answer in your custom repository plugin.

This issue is not related to Filament.

@atmonshi
Copy link
Contributor Author

atmonshi commented Apr 29, 2024 via email

@danharrin danharrin added this to the v3 milestone May 6, 2024
@danharrin
Copy link
Member

Unfortunately I don't think this is possible, as the cluster needs to be read when the routing is registered, and the panel may not be booted at that point so the plugins aren't there

@danharrin danharrin closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority unconfirmed
Projects
Status: Done
Development

No branches or pull requests

3 participants