- 我是laravel5.4的新手。通过使用this url我正在尝试进行用户管理。安装完所有后,我得到以下错误。请帮助解决此错误
(3/3) ErrorException
Call to undefined method Illuminate\Database\Query\Builder::hasRole() (View: /var/www/html/laravel5/resources/views/layouts/app.blade.php) (View: /var/www/html/laravel5/resources/views/layouts/app.blade.php)
<ul class="nav navbar-nav navbar-right">
<!-- Authentication Links -->
@if (Auth::guest())
<li><a href="{{ route('login') }}">Login</a></li>
<li><a href="{{ route('register') }}">Register</a></li>
@else
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
{{ Auth::user()->name }} <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
@role('Admin') {{-- Laravel-permission blade helper --}}
<a href="{{ route('users.index') }}"><i class="fa fa-btn fa-unlock"></i>Admin</a>
@endrole
<a href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
Logout
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
{{ csrf_field() }}
</form>
</li>
</ul>
</li>
@endif
</ul>