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