logo light

Dynamic Color For Panels Per Users

Image Description
By: php coder
  • Published: 24 Mar 2024 Updated: 04 May 2024

let users select a color for the panel

Dynamic Color For Panels Per Users
1return app(StartSession::class)
2 ->handle($request, function ($request) use ($next) {
3 if (! auth()->check()) {
4 return $next($request);
5 }
6 
7 FilamentColor::register([
8 'primary' => constant("Filament\Support\Colors\Color::".auth()->user()->primary_color),
9 ]);
10 
11 return $next($request);
12});

the attribute primary_color will contain the tailwind color name like Sky.

Back to Tricks