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





}