File: D:/HostingSpaces/SBogers87/basephotography.nl/app/Komma/Pages/PageService.php
<?php
namespace Komma\Pages;
use Carbon\Carbon;
class PageService {
protected $pageRepository;
public function __construct(PageRepository $pageRepository)
{
$this->pageRepository = $pageRepository;
}
public function getPageContent($id){
$content = $this->pageRepository->getPageContent($id);
//Encode dynamic
$content->description = json_decode($content->description);
if(isset($content->description[0])) $content->description = $content->description[0];
return $content;
}
public function getUrl($code_name){
return $this->pageRepository->getUrl($code_name);
}
public function getTextBlocks(){
$text = $this->pageRepository->getTextBlocks();
$textArray = [];
foreach($text as $block){
$textArray[$block->code_name] = [
'active' => $block->active,
'title' => $block->name,
'text' => $block->description,
'link' => $block->link,
];
}
return $textArray;
}
}