entrust icon indicating copy to clipboard operation
entrust copied to clipboard

renamed 'can' method to 'permission' since it is in the laravel core

Open n1crack opened this issue 7 years ago • 4 comments

The 'can' method in the user trait is now in the core library, in order to use both functionalities, it is renamed to 'permission'.

n1crack avatar May 12 '17 10:05 n1crack

For anyone else struggling with this, in your user model:

use EntrustUserTrait {
        can as hasPermission;
    }

tripper54 avatar Oct 12 '17 05:10 tripper54

@tripper54 Maybe it makes sense to use

use Illuminate\Foundation\Auth\Access\Authorizable;
// ...
class User extends Authenticatable
// ...
    use Authorizable, EntrustUserTrait {
        Authorizable::can insteadof EntrustUserTrait;
        EntrustUserTrait::can as hasPermission;
    }

because Authorizable::can (standard Laravel method for App\User) is not available in your version. Or I'm wrong?

sergiobelya avatar Dec 24 '17 23:12 sergiobelya

@sergiobelya , you're right, that's a better solution.

tripper54 avatar Jan 04 '18 03:01 tripper54

please solve this conflict , i have error for this

i use your solution but permisson not work

$this->middleware('permission:commnet-manager');

??

how i can middleware ?

webineh avatar Mar 08 '18 18:03 webineh