luya-module-admin
luya-module-admin copied to clipboard
Notifications count with hidden menu
What steps will reproduce the problem?
Add api to hidden menu in module, then send request for this api
What is the expected result?
Don't showing badge on module
What do you get instead? (A Screenshot can help us a lot!)
We don't have count in node but parent have badge (screen)
LUYA Check ouput (run this script and post the result: luyacheck.php)

Additional infos
https://github.com/luyadev/luya-module-admin/blob/master/src/apis/TimestampController.php#L80 This is my solution, maybe this will help
/**
* Returns an array with auth_id as key and value is the diff notification count.
*
* @return array An array with key auth_id and value diff count
* @since 2.0.0
*/
private function getAuthNotifications()
{
$diff = [];
foreach (UserAuthNotification::find()->where(['user_id' => Yii::$app->adminuser->id, 'is_muted' => false])->all() as $uan) {
if (!Yii::$app->adminmenu->getApiDetail($uan->auth->api)["hiddenInMenu"]) {
$diff[$uan->auth_id] = $uan->getDiffCount();
}
}
return $diff;
}
| Q | A |
|---|---|
| LUYA Version | 1.0.26 |
| Admin Version | 3.0.2.0 |
| PHP Version | 7.3.13 |
| Platform | luya serve |
| Operating system | OSX |