I am getting " Call to undefined method Illuminate\Database\Query\Builder::assignPermission() "; while trying to assign permission to admin role.
I am using laravel 5.2
the permissions,roles,permission_role,permission_user,role_user tables are getting created in database. also
Role is getting added in roles table successfully and
user permission is getting added successfully to permissions table
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Blade;
use App\Role;
use App\Permission;
use Kodeine\Acl\Traits\HasPermission;
I am getting " Call to undefined method Illuminate\Database\Query\Builder::assignPermission() "; for above last two lines of code
I have in config\acl.php
return [
'role' => 'kodeine\Acl\Models\Eloquent\Role',
'permission' => 'kodeine\Acl\Models\Eloquent\Permission',
'most_permissive_wins' => false,
];
And my vendor\laravel\frameworl\src\illuminate\Foundation\Auth\User.php is as follows
namespace Illuminate\Foundation\Auth;
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 Kodeine\Acl\Traits\HasRole;
class User extends Model implements
AuthenticatableContract,
CanResetPasswordContract
{
use Authenticatable, CanResetPassword, HasRole;
}
Hi @kodeine ,
I am getting " Call to undefined method Illuminate\Database\Query\Builder::assignPermission() "; while trying to assign permission to admin role.
I am using laravel 5.2
the permissions,roles,permission_role,permission_user,role_user tables are getting created in database. also Role is getting added in roles table successfully and
user permission is getting added successfully to permissions table
namespace App\Providers;
use Illuminate\Support\ServiceProvider; use Blade; use App\Role; use App\Permission; use Kodeine\Acl\Traits\HasPermission;
$role = new Role(); $roleAdmin = $role->create([ 'name' => 'Administrator', 'slug' => 'administrator', 'description' => 'Manage Administration Priviledes' ]);
$permission = new Permission(); $permUser = $permission->create([ 'name' =>'user', 'slug' => json_encode([ 'create' => true, 'view' => true, 'update' => true, 'delete' => true, 'view.phone' ]), 'description' => 'manage user permissions' ]); $roleAdmin = Role::first(); // administrator $roleAdmin->assignPermission('user');
I am getting " Call to undefined method Illuminate\Database\Query\Builder::assignPermission() "; for above last two lines of code
I have in config\acl.php return [ 'role' => 'kodeine\Acl\Models\Eloquent\Role', 'permission' => 'kodeine\Acl\Models\Eloquent\Permission', 'most_permissive_wins' => false, ];
And my vendor\laravel\frameworl\src\illuminate\Foundation\Auth\User.php is as follows
namespace Illuminate\Foundation\Auth; 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 Kodeine\Acl\Traits\HasRole; class User extends Model implements AuthenticatableContract,
CanResetPasswordContract { use Authenticatable, CanResetPassword, HasRole; }