F
Filament12mo ago
lzx1996

how can i use logo from database for Panel Provider ->brandLogo() function

i have a general settings table in database which store all general informations like site name, contact number, logo and etc. How can i call the database in PanelProvider.php file to retrieve the logo from the settings table when i tried to call the Settings::query()...... i get a Connection not found error.
2 Replies
LeandroFerreira
LeandroFerreira12mo ago
->brandLogo(fn () => Settings::query()...) ?
leoblanski
leoblanski12mo ago
@lzx1996 any idea ? I find a solution, that works in my case. Created new middleware "SetCustomSettings" and attached on User Panel Provider. In my case, each customer has your specific team and this team has the configs. If you need to get just first record from database, you could use a closure function inside brandLogo.
->brandLogo(function () {
return Settings::first()->logo;
})
->brandLogo(function () {
return Settings::first()->logo;
})
Something like this.
Want results from more Discord servers?
Add your server