FEATURE #1373: add history of content

This commit contains only core funcionality of displaying history. Module settings must be implemented in each module.
This commit is contained in:
Michal Kváček
2016-02-05 16:06:13 +01:00
parent 0216d923d4
commit 620a5545d8
12 changed files with 370 additions and 18 deletions
+49
View File
@@ -0,0 +1,49 @@
<?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
]);
}
}