@php $allPopups = getPopups(); if($allPopups->count() > 0) { $currentUrl = request()->getPathInfo(); // Gets path like "/media/weekly-messages" $seen_common_popups = @$_COOKIE['seen_common_popups'] ? explode(",",@$_COOKIE['seen_common_popups']) : []; foreach($allPopups as $allPopup) { $isCommonPopupShow = 0; if(in_array($allPopup->id, $seen_common_popups)) { $isCommonPopupShow = 0; } else if($allPopup->is_all_pages) { $isCommonPopupShow = 1; } else if(isset($page->id) && in_array($page->id,explode(",",$allPopup->cms_ids))) { $isCommonPopupShow = 1; } else if (!empty($allPopup->urls)) { $popupUrls = json_decode($allPopup->urls, true); if (is_array($popupUrls)) { foreach ($popupUrls as $popupUrl) { // Support absolute URLs too $parsed = parse_url($popupUrl); $popupPath = $parsed['path'] ?? $popupUrl; if (rtrim($popupPath, '/') === rtrim($currentUrl, '/')) { $isCommonPopupShow = 1; break; } } } } if(($allPopup->user_type == '0' && auth()->check()) || ($allPopup->user_type == '1' && !auth()->check())) { $isCommonPopupShow = 0; } if($isCommonPopupShow) { @endphp
@php break; } } } @endphp