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/BDeurzen/vandeurzentuinontwerp.nl/app/Komma/Pages/PageService.php
<?php


namespace Komma\Pages;
use Carbon\Carbon;
use Komma\Pages\Models\Page;

class PageService {

    protected $pageRepository;

    public function __construct(PageRepository $pageRepository)
    {
        $this->pageRepository = $pageRepository;
    }

    public function getPageContent($id){
        if(!$page = Page::where('id','=',$id)
            ->with('translation')
            ->with('blocks.translation')
            ->with('images') 
            ->first()) \App::abort(404, 'Page not found');

        return $page;
    }

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

    public function getPageByCodeName($codeName){
        if(!$page = Page::where('code_name','=', $codeName)
            ->with('blocks.translation')
            ->with('translation')
            ->first()) \App::abort(404, 'Page not found');

        return $page;
    }

}