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;
}
}