diff --git a/app/Http/Controllers/ProjectController.php b/app/Http/Controllers/ProjectController.php index a5be020..d293cab 100644 --- a/app/Http/Controllers/ProjectController.php +++ b/app/Http/Controllers/ProjectController.php @@ -13,6 +13,7 @@ use App\Models\{ReportActivityMaterial,ProjectToChecklistK3,FolderDocumentProyek use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\{Artisan,DB}; use App\Helpers\MasterFunctionsHelper; +use Carbon\Carbon; const API_GEOLOCATION = "https://nominatim.oslogdev.com/search/ADDR?format=json&addressdetails=1&limit=1"; @@ -178,9 +179,11 @@ class ProjectController extends Controller { DB::beginTransaction(); $data = Project::find($id); + $dateNow = Carbon::now(); if ($data) { - $this->deleteRelative($id, $company_id); - if ($data->delete()) { + // $this->deleteRelative($id, $company_id); + // if ($data->delete()) { + if ($data->update(['deleted_at' => $dateNow, 'deleted_by_id' => $this->currentId])) { DB::commit(); return response()->json(['status' => 'success', 'message' => 'Data deleted!', 'code' => 200], 200); } else { diff --git a/app/Models/Project.php b/app/Models/Project.php index cfd463f..63a1aaf 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -52,6 +52,8 @@ class Project extends Model 'updated_at', 'updated_by', 'created_by_id', - 'company_id' + 'company_id', + 'deleted_at', + 'deleted_by_id' ]; }