Reputation: 38
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 ?
Upvotes: 0
Views: 2745
Reputation: 581
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.
Upvotes: 2