Zizaco / entrust

Role-based Permissions for Laravel 5
MIT License
6.05k stars 1.29k forks source link

Error: Attribute [filter] does not exist. #935

Open anonymouse703 opened 5 years ago

anonymouse703 commented 5 years ago

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?

komalbarun commented 4 years ago

Having same issue after updating october CMS site to php73.