This commit contains only core funcionality of displaying history. Module settings must be implemented in each module.
49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Models\Content;
|
|
use App\Models\ContentHistory;
|
|
|
|
class History extends Controller
|
|
{
|
|
/**
|
|
* @var ContentHistory
|
|
*/
|
|
private $history;
|
|
|
|
public function __construct(ContentHistory $history)
|
|
{
|
|
parent::__construct();
|
|
$this->history = $history;
|
|
}
|
|
|
|
/**
|
|
* @param $id
|
|
*
|
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
|
*/
|
|
public function getOverview($id)
|
|
{
|
|
// test if given content id is static page and if exists
|
|
$content = Content::findOrFail($id);
|
|
|
|
$history = $this->history->getStructuredHistoryOf($content);
|
|
|
|
return view('admin/history.overview', [
|
|
'history' => $history,
|
|
'page' => $content
|
|
]);
|
|
}
|
|
|
|
public function getDiff($revision, $id)
|
|
{
|
|
$change = $this->history->findOrFail($id);
|
|
$diff = $this->history->getDiff($change);
|
|
|
|
return view('admin/history.diff', [
|
|
'change' => $change,
|
|
'columnName' => 'Page content',
|
|
'diff' => $diff
|
|
]);
|
|
}
|
|
} |