changeset draft
This commit is contained in:
@@ -31,7 +31,7 @@ class TableController extends Controller
|
||||
->where('name', $table)->first();
|
||||
if ($tableModel === null) abort(404, "No such table.");
|
||||
|
||||
// make it possible to show other revisions
|
||||
// option to show other revisions
|
||||
if ($input->has('rev')) {
|
||||
$rev = (int)$input->rev;
|
||||
$revision = $tableModel->revisions()->orderBy('created_at')->skip($rev - 1)->first();
|
||||
@@ -54,6 +54,28 @@ class TableController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function draftChange(Request $request, User $user, string $table)
|
||||
{
|
||||
/** @var Table $tableModel */
|
||||
$tableModel = $user->tables()->with('revision')->where('name', $table)->first();
|
||||
if ($tableModel === null) abort(404, "No such table.");
|
||||
|
||||
$revision = $tableModel->revision;
|
||||
|
||||
$columns = Column::columnsFromJson($revision->columns);
|
||||
|
||||
$rows = $revision->rowsData($columns)->paginate(25, []);
|
||||
|
||||
// TODO instantiate changeset and store it in session
|
||||
|
||||
return view('table.view', [
|
||||
'table' => $tableModel,
|
||||
'revision' => $revision,
|
||||
'columns' => $columns,
|
||||
'rows' => $rows,
|
||||
]);
|
||||
}
|
||||
|
||||
public function delete(Request $request, User $user, string $table)
|
||||
{
|
||||
/** @var Table $tableModel */
|
||||
|
||||
Reference in New Issue
Block a user