Multiple shield config

I have 3 panels and i wanna make each panel have different filament shield config for changing scope of auth_provider_model of each panel
2 Replies
Mohamed Ayaou
Mohamed Ayaou4w ago
Having different config files is not meant with shield plugin or even filament but a laravel topic First, you shouldn't use this approach from the first place and add the logic to your targeted provider, config files are meant to not be dynamic If you still need this approach you may break the standards (not recommended at all) then you may think in something like:
// config/filament-shield.php
return require config_path('service/' . env('APP_ENV', 'local') . '.php');

// config/filament-shield.php
return require config_path('service/' . env('APP_ENV', 'local') . '.php');

this code loads a file depending on a env variable but in your case you want this to be in the boot phase for each request/panel many laravel APIs are not available in the config files as the are loaded in an early phase in the request lifecycle in general don't go for this approach and adjust the single provider you have for using a different scope for each request depending on the panel id
zydnrbrn
zydnrbrnOP4w ago
thanks a lot for your answer, btw i need to split guards that read or use by filament shield on each panel, like shield on panel 1 can't manage guard that use on panel 2
//config/filament-shield.php
...
'auth_provider_model' => [
'fqcn' => 'App\\Models\\User',
],
...
//config/filament-shield.php
...
'auth_provider_model' => [
'fqcn' => 'App\\Models\\User',
],
...
im asking about the using multiple config is because i wanna make the filament shield each panel uses different auth_provider_model

Did you find this page helpful?