feat: [bending] 기초자료 복사 버튼 추가 — 복사 후 수정 화면으로 이동

This commit is contained in:
김보곤
2026-03-21 11:49:07 +09:00
parent a8899d48e5
commit 036e346f2c
3 changed files with 28 additions and 0 deletions

View File

@@ -203,6 +203,21 @@ public function update(Request $request, int $id)
return redirect()->route('bending.base.show', $id)->with('success', '절곡품이 수정되었습니다.');
}
public function duplicate(int $id)
{
$response = $this->api()->post("/api/v1/bending-items/{$id}/duplicate");
if (! $response->successful()) {
return back()->withErrors(['api' => $response->json('message', '복사 실패')]);
}
$newId = $response->json('data.id');
$newCode = $response->json('data.code');
return redirect()->route('bending.base.edit', $newId)
->with('success', "복사 완료 — 새 코드: {$newCode}");
}
public function destroy(int $id)
{
$this->api()->delete("/api/v1/bending-items/{$id}");