Laravel-adminlte: How to get 'logo_img' at runtime?

Created on 24 Mar 2020  路  1Comment  路  Source: jeroennoten/Laravel-AdminLTE

Is there any way to change the 'logo _img' dynamically at runtime looking for the path through the database?

I have some customers using the same system, and each company has its logo, I would like the logo to change according to the path registered in the database.

Most helpful comment

Well ... since I didn't get any answers, I gathered what I got in several forums and put my puzzle together, here's the answer for those who need it in the future:

_I added the following listener inside the Boot of AppServiceProvider.php listening to the construction of the menu and it worked! I just needed to use Helper -_config ([''])
_Although I had to change the tenant table to add the columns: logo and logo_xl as AdminLTE uses two types of logo, one for the open menu and another smaller logo when the menu is collapsed ..._

$events->listen(BuildingMenu::class, function (BuildingMenu $event) {
    $user = Auth::user();
    config(['adminlte.logo_img' => $user->tenant->logo]);
    config(['adminlte.logo_img_xl' => $user->tenant->logo_xl]);
});

>All comments

Well ... since I didn't get any answers, I gathered what I got in several forums and put my puzzle together, here's the answer for those who need it in the future:

_I added the following listener inside the Boot of AppServiceProvider.php listening to the construction of the menu and it worked! I just needed to use Helper -_config ([''])
_Although I had to change the tenant table to add the columns: logo and logo_xl as AdminLTE uses two types of logo, one for the open menu and another smaller logo when the menu is collapsed ..._

$events->listen(BuildingMenu::class, function (BuildingMenu $event) {
    $user = Auth::user();
    config(['adminlte.logo_img' => $user->tenant->logo]);
    config(['adminlte.logo_img_xl' => $user->tenant->logo_xl]);
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

santiagoferraz picture santiagoferraz  路  5Comments

bbdangar picture bbdangar  路  5Comments

jlcanizales picture jlcanizales  路  3Comments

rafayet-monon picture rafayet-monon  路  3Comments

eraporsmk picture eraporsmk  路  5Comments