Laravel-adminlte: Sidebar Collapse Button is not working after upgrading

Created on 9 Jun 2020  路  5Comments  路  Source: jeroennoten/Laravel-AdminLTE

I've upgraded the package from 3.2 to 3.3. After upgrading, the buttons from left and right sidebars are not working properly.
The button from left sidebar does not work (does not open or close the sidebar)
And the button from the right sidebar opens and close right after clicking.

I tried to check in console and no errors found. Any ideas?

scheduled solved

Most helpful comment

Hi,

It's working now after made these changes. There are more files that have @extends('adminlte::master') and removed that line suggested. All is working now!

Thank you!

All 5 comments

I've found a problem.
The problem is when using the Laravel Mix.
When adding the line in bootstrap.js
require('../../vendor/almasaeed2010/adminlte/dist/js/adminlte');
is conflicting with the views which already imported the adminlte.min.js

If I comment one of these, the menu works properly.
The question is: Are they the same file? Or is there another solution for this case?

Please, can you try the next solution:

1. Edit the master.blade.php file, so the <body> section looks like this:

<body class="@yield('classes_body')" @yield('body_data')>

    {{-- Body Content --}}
    @yield('body')

    {{-- Base Scripts --}}
    @if(!config('adminlte.enabled_laravel_mix'))
        <script src="{{ asset('vendor/jquery/jquery.min.js') }}"></script>
        <script src="{{ asset('vendor/bootstrap/js/bootstrap.bundle.min.js') }}"></script>
        <script src="{{ asset('vendor/overlayScrollbars/js/jquery.overlayScrollbars.min.js') }}"></script>

        {{-- Configured Scripts --}}
        @include('adminlte::plugins', ['type' => 'js'])

        {{-- NEXT LINE IS ADDED --}}
        <script src="{{ asset('vendor/adminlte/dist/js/adminlte.min.js') }}"></script>
    @else
        <script src="{{ mix(config('adminlte.laravel_mix_js_path', 'js/app.js')) }}"></script>
    @endif

    {{-- Custom Scripts --}}
    @yield('adminlte_js')

</body>

2. On all the blade files that @extends('adminlte::master') change the next lines of code:

@section('adminlte_js')
    <script src="{{ asset('vendor/adminlte/dist/js/adminlte.min.js') }}"></script>
    @stack('js')
    @yield('js')
@stop

by the next ones:

@section('adminlte_js')
    @stack('js')
    @yield('js')
@stop

Those files should be:

  • auth/passwords/confirm.blade.php
  • auth/auth-page.blade.php
  • page.blade.php

Do those changes fixes the problem? A feedback about these changes are welcome, so we can made a fix on the package.

Hi,

It's working now after made these changes. There are more files that have @extends('adminlte::master') and removed that line suggested. All is working now!

Thank you!

The fix comes with the new release v3.3.2.

The fix is released with v3.4.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rafayet-monon picture rafayet-monon  路  3Comments

sebian29 picture sebian29  路  4Comments

santiagoferraz picture santiagoferraz  路  5Comments

vsilva472 picture vsilva472  路  4Comments

WillieOng-HK picture WillieOng-HK  路  4Comments