-
Hello, I am using the awesome package in some of my applications, and it's working perfectly. However, I noticed that none of these applications are using the direct permission assignment feature, but the package is still querying the model_has_permissions table. I was wondering if there is a setting or hook that could allow us to skip this query altogether. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I have successfully overridden the HasPermissions trait in the user model using the following code, and it is currently functioning as intended. However, I would like to know if there is a better way to achieve this. public function getAllPermissions(): Collection
{
$permissions = $this->permissions; // replaced by below line
$permissions = collect();
if (method_exists($this, 'roles')) {
$permissions = $permissions->merge($this->getPermissionsViaRoles());
}
return $permissions->sort()->values();
}
public function hasDirectPermission($permission): bool
{
return false;
} |
Beta Was this translation helpful? Give feedback.
I have successfully overridden the HasPermissions trait in the user model using the following code, and it is currently functioning as intended. However, I would like to know if there is a better way to achieve this.