get(); $customer = Customer::onlyTrashed()->get(); $data = [ 'peti' => Peti::onlyTrashed()->get(), 'customer' => Customer::onlyTrashed()->get(), 'active' => 'menu-Recycle_Data', ]; return view('dashboard.Master_Data.Recycle_Data.index', $data); } public function pulihkanData(Request $request, $model, $id) { $data = null; switch ($model) { case 'peti': $data = Peti::withTrashed()->find($id); break; case 'customer': $data = Customer::withTrashed()->find($id); break; // Add more cases for other models if needed default: return redirect()->back()->with('error', 'Model tidak valid.'); } if ($data) { $data->restore(); return redirect()->back()->with('success', "Data $model berhasil dipulihkan."); } else { return redirect()->back()->with('error', 'Data tidak ditemukan.'); } } public function hapusPermanenData($model, $id) { $data = null; switch ($model) { case 'peti': $data = Peti::withTrashed()->find($id); break; case 'customer': $data = Customer::withTrashed()->find($id); break; // Add more cases for other models if needed default: return redirect()->back()->with('error', 'Model tidak valid.'); } if ($data) { $data->forceDelete(); return redirect()->back()->with('success', "Data $model berhasil dihapus permanen."); } else { return redirect()->back()->with('error', 'Data tidak ditemukan.'); } } }