where('role_id', $role_id)->findAll(); } catch (\Exception $e) { // Log the error message if the query fails log_message('error', 'Error fetching role permissions for role ID: ' . $role_id . ': ' . $e->getMessage()); // Rethrow the exception to be handled by the caller throw $e; } } public function getPermissionsByRole($roleId) { return $this->where('role_id', $roleId)->findAll(); } public function deleteByRole($roleId) { return $this->where('role_id', $roleId)->delete(); } }