调用未定义的方法Illuminate \ Session \ Store :: user()

时间:2019-11-21 01:41:53

标签: php laravel session

调用未定义的方法Illuminate \ Session \ Store :: user()(视图:C:\ xampp \ htdocs \ vms_ut \ resources \ views \ layouts \ navbar.blade.php)(视图:C:\ xampp \ htdocs \ vms_ut \ resources \ views \ layouts \ navbar.blade.php)

  

查看

<ul class="navbar-nav">
                    <li><a href="{{url('/home')}}">Home</a></li> &nbsp&nbsp
                    @if (Session::user()->level == 'Admin')
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">
                            Master <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="">Data</a></li>
                            <li><a href="">Warehouse</a></li>
                        </ul>
                    </li>
                     @else  (Session::user()->level == 'Penyedia')
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button">
                            Master <span class="caret"></span>
                        </a>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="">Data</a></li>
                        </ul>
                    </li>
                    @endif
                </ul>

查看

enter image description here

请帮助我

2 个答案:

答案 0 :(得分:1)

您是指Auth而不是Session?

更改此行:

@if (Session::user()->level == 'Admin')

此行

@if (Auth::user()->level == 'Admin')

答案 1 :(得分:0)

您可以像这样使用会话外观:

for (; i < len ; i++) { c = read();