Zizaco / entrust

Role-based Permissions for Laravel 5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Attribute [filter] does not exist.

anonymouse703 opened this issue · comments

Laravel Version: 5.6

Error: ** Attribute [filter] does not exist.**
Case: When using the following syntax (below) in my my route I had this kind of error Attribute [filter] does not exist.
Goal: filter permission per page.

Syntax 1.

Route::filter(['superadmin','admin'], function()
{
    // check the current user
    if (!Entrust::can(['can.create.user','can.edit.user','can.delete.user'])) {
        return Redirect::to('user-access');
    }
});

// only users with roles that have the 'manage_posts' permission will be able to access any admin/post route
Route::when('user-access', ['superadmin','admin']);

Syntax 2.

Entrust::routeNeedsRoleOrPermission(
    'user-access',
    array('superadmin', 'admin'),
    array('can.create.user', 'can.edit.user','can.delete.user'),
    null,
    false
);

How to solve this?

Having same issue after updating october CMS site to php73.