feat: add AJAX functionality to delete project updates and announcements
This commit is contained in:
@@ -195,6 +195,33 @@ class ProjectController extends Controller
|
||||
return back()->with('success', 'Yeni ilerleme duyurusu yayınlandı.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Web Manager Action: Delete Live Progress Update / Announcement
|
||||
*/
|
||||
public function deleteUpdate(Request $request, string $slug)
|
||||
{
|
||||
$project = Project::where('slug', $slug)->firstOrFail();
|
||||
|
||||
$request->validate([
|
||||
'update_id' => 'required|exists:project_updates,id',
|
||||
]);
|
||||
|
||||
$update = ProjectUpdate::where('id', $request->input('update_id'))
|
||||
->where('project_id', $project->id)
|
||||
->firstOrFail();
|
||||
|
||||
$update->delete();
|
||||
|
||||
if ($request->wantsJson() || $request->ajax()) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Duyuru başarıyla silindi.',
|
||||
]);
|
||||
}
|
||||
|
||||
return back()->with('success', 'Duyuru başarıyla silindi.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Web Manager Action: Recalculate Progress %
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user