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/SBogers10/kemi.komma.pro/app/KommaApp/Posts/PostController.php
<?php

namespace App\KommaApp\Posts;

use App\Http\Controllers\Controller;
use App\KommaApp\Posts\Models\Post;

class PostController extends Controller
{
    private $pagePrefix = 'pages.posts.';
    private $postService;

    public function __construct(PostService $postService)
    {
        parent::__construct();
        $this->postService = $postService;
    }

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

        $posts = $this->postService->getAllPosts(true);
        $posts->withPath($this->links->posts->route);

        $view = 'index';
        if(\Input::get("page", 1) == 1) $view = 'index_first';

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


    /**
     * @param Post $post
     * @return \Illuminate\Contracts\View\View
     */
    public function show(Post $post)
    {
        $post->load('translation');

        $page = $this->pageService->getPageByCodeName('posts');
        $page->translation = $this->decodeDynamicContent( $page->translation );
        $post->translation = $this->decodeDynamicContent( $post->translation );
        $otherLanguageRoutes = $this->languageService->getOtherLanguagesRoutes($page, $post);

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

}