File: D:/HostingSpaces/SBogers10/arborconsulting.komma.pro/app/KommaApp/Services/ServiceController.php
<?php
namespace App\KommaApp\Services;
use App\Http\Controllers\Controller;
use App\KommaApp\Services\Models\Service;
class ServiceController extends Controller
{
private $pagePrefix = 'pages.services.';
private $serviceService;
public function __construct(ServiceService $serviceService)
{
parent::__construct();
$this->serviceService = $serviceService;
}
/**
* @return \Illuminate\Contracts\View\View
*/
public function index()
{
$page = $this->pageService->getPageByCodeName('services');
$otherLanguageRoutes = $this->languageService->getOtherLanguagesRoutes($page);
$services = $this->serviceService->getAllServices(true);
$services->withPath('/' . $this->links->services->route);
// Decode the dynamic content
$page->translation = $this->decodeDynamicContent( $page->translation );
// Return view
return \View::make($this->baseViewPath.$this->pagePrefix.'index',[
'page' => $page,
'links' => $this->links,
'otherLanguages' => $otherLanguageRoutes,
'services' => $services,
]);
}
/**
* @param Service $service
* @return \Illuminate\Contracts\View\View
*/
public function show(Service $service)
{
$service->load('translation');
$page = $this->pageService->getPageByCodeName('services');
$otherLanguageRoutes = $this->languageService->getOtherLanguagesRoutes($page, $service);
// Load all Services
$services = $this->serviceService->getAllServices();
// Decode the dynamic content
$service->translation = $this->decodeDynamicContent( $service->translation );
// Return view
return \View::make($this->baseViewPath.$this->pagePrefix.'show',[
'page' => $page,
'service' => $service,
'links' => $this->links,
'services' => $services,
'otherLanguages' => $otherLanguageRoutes,
]);
}
}