1

I am trying to add Route::group() based on a users role.

Route::group(['middleware' => ['role:myrole']], function () {
    //Some Routes
}

I am getting this error...

Missing argument 3 for Zizaco\Entrust\Middleware\EntrustRole::handle()

I have the default install for Entrust. I am told that I need to add a line or two to the Kernel.php file in '$middlewareGroups'

What are the lines?

4

2 回答 2

1

你正在寻找这些我认为:

'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class,

注意,我有它们$routeMiddleware

然后将您认为适合的角色/权限分配给组或个人路线。但将它们存储在$routeMiddleware. 例如:

Route::group(['middleware' => ['role:admin|owner']], function () { .. });

于 2016-06-17T18:18:32.127 回答
0

好吧,没有发现“正确”的方法。所以我使用了一种解决方法。我在刀片文件中使用了@role。对我来说这是一个黑客,但它有效。

于 2016-06-24T20:25:42.347 回答