File: D:/HostingSpaces/SBogers10/stempel.komma.pro/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;
final 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;
}
}