<?php

namespace App\Http\Controllers\Site;

use App\Models\ServiceContent;
use Illuminate\Http\Request;

class ServicesController
{
    public function index(Request $request) {

		$path = $request->path();

		$pagePayload = new \stdClass();

		$pagePayload->siteManagement = getSiteManagement($path);
		$navPayload = getNavSiteManagement();
		
		return view('site.pages.services.services', [
			'pagePayload' => $pagePayload,
			'navPayload' => $navPayload
		]);
	}

	public function show($id)
    {
        $serviceContent = getServiceContent($id);

		$navPayload = getNavSiteManagement();
		
		$dataBanner = new \stdClass();
		$dataBanner = getSiteManagement('services');
		$dataBanner['site.components.banner']->title->value = $serviceContent[$id]->title->value;

		$pagePayload = new \stdClass();
		$pagePayload->siteManagement['site.components.banner'] 		 	 = $dataBanner['site.components.banner'];
		$pagePayload->siteManagement['site.components.services.content'] = $serviceContent[$id];
		
        return view('site.pages.services.servicesContent', [
			
			'pagePayload' => $pagePayload,
			'navPayload' => $navPayload
		]);
    }
}
