LazyBoy
LazyBoy
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
Because in my case im fetching a single company from the database, but it would be tricky if it was like your case with a lot of users
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
I think your best bet in this case is to set a default color and change it only if a user has an active session, otherwise I am not sure if there is a better approach
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
I put it in the AppServiceProviders boot(), yep I am fetching the color from the db 🙂
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
been struggling for the past couple of hours haha
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
thank you so much! Appreciate it a lot!
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
oh that worked 😄
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
if im not wrong it should be added to the boot method right?
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
thank you for taking the time btw appreciate it a lot 😄
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
it does pass it when i dd the return of bootUsing correctly, but if i dd the whole panel the colors array is empty
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
this is the code:
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login()
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
Widgets\AccountWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
])
->plugin(FilamentSpatieLaravelBackupPlugin::make())
->configureUsing(function (Panel $panel){
dd(Company::first()->brand_color);
$panel->colors([
'primary' => Company::first()->brand_color ?? '#FF6921'
]);
});
}
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login()
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
Widgets\AccountWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
])
->plugin(FilamentSpatieLaravelBackupPlugin::make())
->configureUsing(function (Panel $panel){
dd(Company::first()->brand_color);
$panel->colors([
'primary' => Company::first()->brand_color ?? '#FF6921'
]);
});
}
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
App\Providers\Filament\AdminPanelProvider::panel(): Return value must be of type Filament\Panel, null returned
App\Providers\Filament\AdminPanelProvider::panel(): Return value must be of type Filament\Panel, null returned
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
It is throwing an error and returning null
33 replies
FFilament
Created by LazyBoy on 12/6/2023 in #❓┊help
Change AdminPanelProvider primary color through model
I tried with the following by checking available examples for configureUsing online and added configureUsing in the boot method of the AdminPanelProvider like this but had no success, not sure if im doing something wrong
public function boot()
{
Panel::configureUsing(function (Panel $panel){
$panel->colors([
'primary' => Company::first()->brand_color ?? '#FF6921'
]);
});
}
public function boot()
{
Panel::configureUsing(function (Panel $panel){
$panel->colors([
'primary' => Company::first()->brand_color ?? '#FF6921'
]);
});
}
33 replies