HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/ijzerenman.komma.pro/app/Custom/Navigation/PageNavigationService.php
<?php


namespace Komma\Navigation;


use Komma\Pages\PageRepository;

use Komma\Kms\Pages\PageRepository as KmsPageRepository;

class PageNavigationService
{
    /**
     * @var PageRepository
     */
    private $pageRepository;

    /**
     * @var GlobalNavigationService
     */
    private $globalNavigationService;

    /**
     * @param GlobalNavigationService $globalNavigationService
     * @param PageRepository $pageRepository
     */
    public function __construct(GlobalNavigationService $globalNavigationService, PageRepository $pageRepository)
    {
        $this->pageRepository = $pageRepository;
        $this->globalNavigationService = $globalNavigationService;
    }

    public function get($id = null)
    {
        if($id != null)
        {
            $globalParentId = $id;
        }
        else
        {
            if( ! \Request::ajax())
            {
                $globalParentId = \Current::parents()[0]->id;
            }
            else
            {
                $globalParentId = \Input::get('global');
            }
        }

        return $this->pageRepository->getImmediateChildren($globalParentId);
    }

    public function repository()
    {
        return $this->pageRepository;
    }
}