make sure notification always returns array

This commit is contained in:
Denis Duliçi
2021-08-08 23:44:59 +03:00
parent 1921c3465d
commit d3233740b3
5 changed files with 57 additions and 47 deletions

View File

@ -2,8 +2,8 @@
namespace App\Http\ViewComposers;
use App\Utilities\Versions;
use App\Traits\Modules;
use App\Utilities\Versions;
use Illuminate\View\View;
class Header
@ -71,16 +71,14 @@ class Header
$new_apps = $this->getNotifications('new-apps');
if ($new_apps) {
foreach ($new_apps as $key => $new_app) {
if (setting('notifications.' . user()->id . '.' . $new_app->alias)) {
unset($new_apps[$key]);
foreach ($new_apps as $key => $new_app) {
if (setting('notifications.' . user()->id . '.' . $new_app->alias)) {
unset($new_apps[$key]);
continue;
}
$notifications++;
continue;
}
$notifications++;
}
}

View File

@ -3,7 +3,7 @@
namespace App\Http\ViewComposers;
use App\Traits\Modules;
use Route;
use Illuminate\Support\Facades\Route;
use Illuminate\View\View;
class Notifications
@ -29,9 +29,7 @@ class Notifications
$path = str_replace('{company_id}/', '', $path);
if (!$notifications = $this->getNotifications($path)) {
return;
}
$notifications = $this->getNotifications($path);
// Push to a stack
foreach ($notifications as $notification) {