FIX: hide protected pages from menu widget

This commit is contained in:
Michal Kváček
2016-10-04 13:09:32 +02:00
parent f1aacf8008
commit ab90b907f8
2 changed files with 8 additions and 0 deletions
+7
View File
@@ -72,8 +72,15 @@ class Menu extends NonInstallableWidget
public static function selectContentPages($ids)
{
$allowedStatuses = [Content::STATUS_PUBLIC];
if (\Auth::user()) {
$allowedStatuses[] = Content::STATUS_PROTECTED;
}
$pages = Content::where('language', LaravelLocalization::getCurrentLocale())
->whereIn('id', $ids)
->whereIn('status', $allowedStatuses)
->get();
$used = [];
foreach ($pages as $page) {