Closed atmacoder closed 6 years ago
sorry it is ok now))
just space between
if(is_string($role)) { return $this->roles()->attach(Role::where('slug', $role)->first()); }
This should fix the problem:
/**
* Determine if any of the assigned roles to this user
* have a specific permission
*
* @param string $permission
* @return boolean
*/
public function hasRoleWithPermission($permission)
{
return !is_null($this->roles()->count()) ? $this->roles()->get()->contains(function ($role) use ($permission) {
return $role->getPermissions()->get()->contains('permission_slug', $permission);
}) : null;
}
`/home /kpvrp56vtcsd /public_html /site.com /vendor /silvanite /brandenburg /src /Traits /HasRoles.php /**
@return boolean */ public function hasRoleWithPermission($permission) { return $this->roles->contains(function ($role) use ($permission) { return $role->getPermissions->contains('permission_slug', $permission); }); }
/**