<?php

namespace App\Http\Controllers\Web;

use App\About;
use App\Http\Controllers\Controller;
use App\Page;
use App\Photo;
use App\PhotoCategory;
use App\Product;
use App\Project;
use App\Room;
use App\Service;
use App\WorkWay;
use Illuminate\Http\Request;

use App\User;
use Notification;
use App\Notifications\ArticlesNotification;
use App\WebsitePhoto;
use Config;
use Illuminate\View\View;

class ServiceController extends Controller
{
    private $view = 'web.services.';

    /**
     * Show the application dashboard.
     * @param null $hash
     * @return View
     */
    public function index(): View
    {
        $services = Service::getService();
        $servicePage = Page::details(8);
        $title = $servicePage->title ?? __('services.head');
        $keywords= $servicePage->keywords ??__('services.head');
        $meta_description = $servicePage->meta_description ??__('services.head');
        $hash = request()->query('hash');

        if ($hash){
            session()->flash('hash', $hash);
            $servicePage = Page::details(9);
            $workWays = WorkWay::withDescription();
            return view($this->view.'show', compact('services', 'servicePage', 'workWays', 'hash', 'title', 'keywords', 'meta_description'));
        }

        return view($this->view.'index', compact('services', 'servicePage', 'title', 'keywords', 'meta_description'));
    }
}
