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/fire-tech/fire-tech.nl/app/KommaApp/Course/CourseController.php
<?php

namespace App\KommaApp\Courses;

use App\Http\Controllers\Controller;
use App\KommaApp\Courses\Models\Course;

class CourseController extends Controller
{
    private $pagePrefix = 'pages.courses.';

    private $courseService;

    /**
     * CourseController constructor.
     * @param CourseService $serviceService
     */
    public function __construct(CourseService $courseService)
    {
        parent::__construct();
        $this->courseService = $courseService;
    }

    /**
     * @return \Illuminate\Contracts\View\View
     */
    public function index()
    {
        $page = $this->pageService->getPageByCodeName('courses');
        $page->translation = $this->decodeDynamicContent($page->translation);
        $otherLanguageRoutes = $this->languageService->getOtherLanguagesRoutes($page);

        $courses = $this->courseService->getAllCourses();
        //$courses->withPath('/' . $this->links->courses->route);

        // Return view
        return \View::make($this->baseViewPath . $this->pagePrefix . 'index', [
            'page' => $page,
            'links' => $this->links,
            'otherLanguages' => $otherLanguageRoutes,
            'courses' => $courses,
        ]);
    }

    /**
     * @param Course $course
     * @return \Illuminate\Contracts\View\View
     */
    public function show(Course $course)
    {

        $course->load('translation');

        $page = $this->pageService->getPageByCodeName('courses');
        $otherLanguageRoutes = $this->languageService->getOtherLanguagesRoutes($page, $course);

        // Load all Projects
        $courses = $this->courseService->getAllCourses();

        // Decode the dynamic content
        $course->translation = $this->decodeDynamicContent($course->translation);

        // Return view
        return \View::make($this->baseViewPath . $this->pagePrefix . 'show', [
            'page' => $page,
            'course' => $course,
            'links' => $this->links,
            'courses' => $courses,
            'otherLanguages' => $otherLanguageRoutes,
        ]);
    }

}