Use temporary negative IDs for rows created in a draft Changeset
This commit is contained in:
@@ -334,6 +334,23 @@ class TableEditController extends Controller
|
||||
*/
|
||||
public function draftSubmit(Request $request, User $user, string $table)
|
||||
{
|
||||
/** @var Table $tableModel */
|
||||
$tableModel = $user->tables()->where('name', $table)->first();
|
||||
if ($tableModel === null) abort(404, "No such table.");
|
||||
|
||||
$input = $this->validate($request, [
|
||||
'note' => 'required|string'
|
||||
]);
|
||||
|
||||
$changeset = $this->getChangeset($tableModel);
|
||||
$changeset->note = trim($input->note);
|
||||
if (empty($changeset->note)) throw new SimpleValidationException('note', 'Note is required.');
|
||||
|
||||
if (!$changeset->getRowChangeCounts()->any && !$changeset->getColumnChangeCounts()->any) {
|
||||
flash()->error("There are no changes to submit.");
|
||||
return back();
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user