tomatophp / filament-plugins

Manage your modules as a plugin system with plugin generator
https://tomatophp.com/en/open-source/filament-plugins
MIT License
29 stars 9 forks source link

Problem on Icon Picker Package with Multi Tenant #2

Closed 3x1io closed 5 months ago

3x1io commented 5 months ago

when having filament multi-tenancy enabled the views lack the tenant parameter for route() for example in table.blade.php

<x-filament::icon-button tooltip="Generate" tag="a" href="{{route('filament.'.filament()->getCurrentPanel()->getId().'.resources.tables.index', ['module'=>$item->module_name, 'tenant' => filament()->getTenant()->id ])}}">

I have to add 'tenant' => filament()->getTenant()->id to the route params array.

and it's not only in the views but also in the Actions\Action::make('create') etc. etc.

3x1io commented 5 months ago

i think this issues i related to icon picker package you can open an issues here

https://github.com/lukas-frey/filament-icon-picker/issues

eelco2k commented 5 months ago

no i think it has to do with the the route() helper. at least in my configuration i need to specify a tenant parameter in the route() helper when tenancy is enabled.

so in version 1.0.1 i still get the error in tables.blade.php:32 and in TomatoPHP \ FilamentPlugins \ Resources \ TableResource \ Pages \ ListTables : 19

Missing required parameter for [Route: filament.tenant-admin.resources.tables.index] [URI: admin/{tenant}/tables] [Missing parameter: tenant].

when i add this extra parameter on tables.blade.php:32 and ListTables.php:19 everything is fine

'tenant' => filament()->getTenant()->id ?? null

so in the table.blade.php the route() looks like this:

route('filament.'.filament()->getCurrentPanel()->getId().'.resources.tables.index', ['module'=>$item->module_name,
                        'tenant' => filament()->getTenant()->id ?? null
                        ])

and in ListTables.php

route('filament.'.filament()->getCurrentPanel()->getId().'.resources.tables.create', ['module' => request()->get('module'), 'tenant' => filament()->getTenant()->id ?? null])
eelco2k commented 5 months ago

I had nothing to do with package but in specific configuration with stancl/tenancy package.

See solution https://github.com/archtechx/tenancy/issues/471