Closed free-storage closed 3 months ago
Just register your cluster class in the shield config.
Just register your cluster class in the shield config.
Yes, but the file will remain in the same location app/Filament/Resources/Shield/RoleResource.php
. I want to move the file here app/Filament/Clusters/Settings/Resources/Shield/RoleResource.php
to keep the application structure.
You need to modify $roleResourcePath = app_path((string) Str::of('Filament\\Resources\\Shield\\RoleResource.php')->replace('\\', '/'));
in isResourcePublished()
and add the path to the cluster if it is specified in the config. Do a check either here or there.
Keeping the structure as recommended is for your own application not plugins.
Keeping the structure as recommended is for your own application not plugins.
I modified RoleResource.php so it is part of my application. So I want to place it in the right place.
Can you improve isResourcePublished() so that it additionally checks against the specified cluster? This will solve the problem. Because if you move RoleResource.php to the directory with the cluster, then the condition will break here and your script will connect the standard resource https://github.com/bezhanSalleh/filament-shield/blob/3.x/src/FilamentShieldPlugin.php#L29
@bezhanSalleh Improve isResourcePublished() to allow the resource to be moved to the cluster?
How to transfer correctly
app/Filament/Resources/Shield/RoleResource.php
inapp/Filament/Clusters/Settings/Resources/Shield/RoleResource.php
?The plugin has this method in https://github.com/bezhanSalleh/filament-shield/blob/3.x/src/Support/Utils.php#L18:
If I transfer, the plugin will not correctly determine the location of the resource.