|
@@ -92,6 +92,18 @@ class StatTreeController extends Controller
|
|
return $this->pass();
|
|
return $this->pass();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function remove(Request $request) {
|
|
|
|
+ $statTree = StatTree::where('uid', $request->input('uid'))->first();
|
|
|
|
+ if(!$statTree) return $this->pass();
|
|
|
|
+ DB::statement("DELETE FROM stat_tree_line WHERE stat_tree_id = :stat_tree_id", ['stat_tree_id' => $statTree->id]);
|
|
|
|
+ DB::statement("DELETE FROM stat_tree_line_clause WHERE stat_tree_id = :stat_tree_id", ['stat_tree_id' => $statTree->id]);
|
|
|
|
+ DB::statement("DELETE FROM stat_tree_line_clause_arg WHERE stat_tree_id = :stat_tree_id", ['stat_tree_id' => $statTree->id]);
|
|
|
|
+ DB::statement("DELETE FROM stat_tree_line_clause_arg_value WHERE stat_tree_id = :stat_tree_id", ['stat_tree_id' => $statTree->id]);
|
|
|
|
+ DB::statement("DELETE FROM stat_tree_line_report_column WHERE stat_tree_id = :stat_tree_id", ['stat_tree_id' => $statTree->id]);
|
|
|
|
+ DB::statement("DELETE FROM stat_tree WHERE id = :stat_tree_id", ['stat_tree_id' => $statTree->id]);
|
|
|
|
+ return $this->pass();
|
|
|
|
+ }
|
|
|
|
+
|
|
public function instantiate(Request $request, StatTree $statTree) {
|
|
public function instantiate(Request $request, StatTree $statTree) {
|
|
if(!$statTree->is_template) {
|
|
if(!$statTree->is_template) {
|
|
return $this->fail("State tree is not a template!");
|
|
return $this->fail("State tree is not a template!");
|
|
@@ -126,15 +138,6 @@ class StatTreeController extends Controller
|
|
return view('app.stat-tree.stat-trees.sub.edit', compact('statTree', 'linesFlat'));
|
|
return view('app.stat-tree.stat-trees.sub.edit', compact('statTree', 'linesFlat'));
|
|
}
|
|
}
|
|
|
|
|
|
- public function delete(Request $request){
|
|
|
|
- $request->validate([
|
|
|
|
- 'id' => 'required'
|
|
|
|
- ]);
|
|
|
|
- $id = $request->get('id');
|
|
|
|
- $statTree = StatTree::where('id', $id)->first();
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
public function replaceAllLines(Request $request){
|
|
public function replaceAllLines(Request $request){
|
|
|
|
|
|
$parents = [];
|
|
$parents = [];
|