roles
roles copied to clipboard
FatalErrorException in User.php line 42: Trait method can has not been applied, because there are collisions with other trait methods on App\User
I get error
FatalErrorException in User.php line 42: Trait method can has not been applied, because there are collisions with other trait methods on App\User
<?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Bican\Roles\Traits\HasRoleAndPermission;
use Bican\Roles\Contracts\HasRoleAndPermission as HasRoleAndPermissionContract;
class User extends Model implements AuthenticatableContract,
AuthorizableContract,
CanResetPasswordContract,
HasRoleAndPermissionContract
{
use Authenticatable, Authorizable, CanResetPassword, HasRoleAndPermission;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['first_name', 'name', 'email', 'password','username'];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = ['password', 'remember_token'];
}
I have the same error. how i can solve it?
@montes2012 in my case I could solve this by removing 'Authorizable' class from User model in this line: use Authenticatable, Authorizable, CanResetPassword, HasRoleAndPermission; now: use Authenticatable, CanResetPassword, HasRoleAndPermission;
There is a collisions between @romanbican roles and Authorizable. Refer to @christopherburton PR for solutions.
Check: #110, #133 Fix: #114