Search code examples
laraveladminlte

How to change the Menu configuration of laravel AdminLTE, other than the menu Icons (like the links). I need to update the logo on runtime based on DB


I need to Update the Logo on the Laravel AdminLTE on runtime based on a value from Database, as currently it is handled by the adminlte.php config file. I have tried passing a global variable (say $logoUrl) to every view with View Composers and then I use javascript to change the logo src value.

document.addEventListener("DOMContentLoaded", function(){
    document.getElementsByClassName('brand-image')[0].src = "{{ $logoUrl}}"
})

This works but it takes a split second to reflect after the page loads.

Is there a better way to do this ?


Solution

  • If you're using this package https://github.com/jeroennoten/Laravel-AdminLTE/wiki/Views-Customization.

    Then you're able to publish the views if you need to customise them by running this command: php artisan adminlte:install --only=main_views

    Here you can read about customising the views.