Browse Source

handle delete Gantt

pull/3/head
wahyuun 1 year ago
parent
commit
a90e077b9b
  1. 21
      app/Http/Controllers/VersionGanttController.php

21
app/Http/Controllers/VersionGanttController.php

@ -2,8 +2,15 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Link;
use App\Models\Holiday;
use App\Models\Activity;
use App\Models\VersionGantt;
use Illuminate\Http\Request;
use App\Models\ShowHideColumn;
use App\Models\UserToActivity;
use App\Models\UserToVersionGantt;
use App\Models\ActivityProgressLog;
class VersionGanttController extends Controller
{
@ -49,6 +56,7 @@ class VersionGanttController extends Controller
if($data){
$delete = $data->delete();
$this->deleteRelative($data['id']);
}else{
return response()->json(['status'=>'failed','message'=>'data version gantt Project not found!','code'=>400], 400);
die();
@ -62,6 +70,17 @@ class VersionGanttController extends Controller
}
}
private function deleteRelative($version_gantt_id)
{
UserToActivity::where('version_gantt_id', $version_gantt_id)->delete();
Activity::where('version_gantt_id', $version_gantt_id)->delete();
ShowHideColumn::where('version_gantt_id', $version_gantt_id)->delete();
Link::where('version_gantt_id', $version_gantt_id)->delete();
UserToVersionGantt::where('version_gantt_id', $version_gantt_id)->delete();
Holiday::where('version_gantt_id', $version_gantt_id)->delete();
ActivityProgressLog::where('version_gantt_id', $version_gantt_id)->delete();
}
public function edit($id){
if(!$id || (int) $id < 0 || $id==""){
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400);

Loading…
Cancel
Save