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/Neopoints/momsecurity.be/app/Komma/Kms/ActionLog/ActionLogController.php
<?php

namespace App\Komma\Kms\ActionLog;

/**
 * @author      Komma <info@komma.pro>
 * @copyright   (c) 2012-2016, Komma
 */

use App\Komma\Kms\Core\SectionController;
use Illuminate\Http\Request;

class ActionLogController extends SectionController
{
    protected $slug = "actionlog";
    protected $forModelName = ActionLog::class; //We need to set a model although we don't even use it. This is because of the core of the KMS demands it

    public function __construct(ActionLogSection $section)
    {
        parent::__construct($section);
    }

    public function index() {
        $this->authorize('viewLogs', ActionLog::class);

        // Build section tabs
        $this->section->getSectionTabDirector()->buildTabs();

        return $this->section->render();
    }

    /**
     * Triggered when the retrieve button is pressed
     *
     * @param Request $request
     * @return \Illuminate\Contracts\View\View
     * @throws \Illuminate\Auth\Access\AuthorizationException
     */
    public function retrieve(Request $request)
    {
        $this->authorize('viewLogs', ActionLog::class);

        /** @var ActionLogService $service */
        $service = $this->section->getSectionService();
        if(!is_a($service, ActionLogService::class)) throw new \RuntimeException('The section service must be "'.ActionLogService::class.'". Got "'.get_class($service).'"');


        $this->section->getSectionTabDirector()->buildTabs();
        $renderedView = $this->section->render();

        $this->section->fillAttributesFromInput();

        $logs = $this->section->getActionLogs();
        $renderedView->withLogs($logs);

        return $renderedView;
    }
}