问题标签 [laravel-gate]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
laravel-8 - 传递给 App\Models\User::hasAnyRoles() 的参数 1 必须是数组类型,给定字符串
我想限制管理员访问某些页面并在运行我的代码后收到此错误:传递给 App\Models\User::hasAnyRoles() 的参数 1 必须是数组类型,给定字符串,在 F:\Main Server 中调用\htdocs\voskillproject\app\Providers\AuthServiceProvider.php 在第 33 行(查看:F:\Main Server\htdocs\voskillproject\resources\views\backend\adminsidebar.blade.php)
这是我的用户模型
这是我的 authserviceprovider,我在其中注册了我的大门
这是导航栏部分
我不明白我的代码哪里做错了
php - laravel 中门和中间件的主要区别是什么?
各位,我只想问一个非常明确的问题。我知道这是用于对用户进行身份验证的中间件,但门和策略会根据他/她的角色来限制用户行为。如果用户未通过身份验证,我使用 LARAVEL gates 将用户重定向到登录页面所以,问题是:LARAVEL 中间件是否包含 Gates 或什么?谢谢先进。