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

Registering new types does not work when using "laravel/octane" #52

Closed
BelyaevAD opened this issue Nov 13, 2022 · 5 comments
Closed

Registering new types does not work when using "laravel/octane" #52

BelyaevAD opened this issue Nov 13, 2022 · 5 comments

Comments

@BelyaevAD
Copy link

Hello, @ryangjchandler

Registering new types "FilamentNavigation::addItemType()" does not work through AppServiceProvider when using "laravel/octane" and roadrunner

@ryangjchandler
Copy link
Owner

@BelyaevAD Are you on the latest version?

@BelyaevAD
Copy link
Author

BelyaevAD commented Nov 14, 2022

Yes, all packages have latest version.
image

Tried doing the following steps:
sail composer install
sail composer run-script post-autoload-dump
sail composer run-script post-update-cmd
sail artisan optimize:clear
sail artisan octane:reload

I use sail+octane+roadrunner in production.

And it works correctly through tinker:
image

Maybe the problem is this: livewire/livewire#3987

@ryangjchandler
Copy link
Owner

Hm, that shouldn't be a problem. The singleton is bound as a scoped singleton meaning it only lasts as long as a single request, even inside of Octane...

@BelyaevAD
Copy link
Author

BelyaevAD commented Nov 24, 2022

To work properly, you need to use Filament::serving

I recommend adding this to the documentation.

Example:

add in App\Providers\AppServiceProvider:

    public function boot()
    {
        Filament::serving(function () {
            FilamentNavigation::addItemType('Routes', [
                Select::make('route')
                    ->searchable()
                    ->options(function () {
                        return Helper::routeList();
                    }),
                TextInput::make('params')->label('explode params by separator "|" '),
            ]);

            FilamentNavigation::addItemType('BlogCategories', [
                Select::make('list')
                    ->multiple()
                    ->options(function () {
                        return Helper::blogCategories();
                    }),
            ]);
        });
    }

@ryangjchandler
Copy link
Owner

Feel free to open a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants