File: D:/HostingSpaces/SBogers68/otium-gebiedsontwikkeling.nl/app/Projects/ProjectController.php
<?php
namespace App\Projects;
use App\Base\Controller;
use App\Projects\Models\Project;
use Komma\KMS\Components\ComponentService;
class ProjectController extends Controller
{
private $projectService;
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->getAllProjects();
$componentService = app(ComponentService::class);
$components = $componentService->getViewComponents($page->translation);
// Return view
return view('templates.projects_index',[
'page' => $page,
'components' => $components,
'projects' => $projects,
'links' => $this->links,
]);
}
/**
* @param Project $service
* @return \Illuminate\Contracts\View\View
*/
public function show(Project $project)
{
$project->load('translation','translations');
$projects = $this->projectService->getMoreProjects($project);
$page = $this->links->projects->node;
$componentService = app(ComponentService::class);
$components = $componentService->getViewComponents($project->translation);
$viewData = [
'page' => $page,
'components' => $components,
'projects' => $projects,
'project' => $project,
'links' => $this->links,
];
$this->pageService->setSharableVariables($project->servicepoint_id, $project->servicepoint_button_id, $project->servicepoint_heading);
// Return view
return view('templates.projects_show', $viewData);
}
}