input('draw_ids', []); if (!is_array($drawIds) || empty($drawIds)) { return ApiResponse::error(trans('api.invalid_params'), ErrorCode::ClientHttpError->value, [], 400); } $results = [ 'success' => [], 'failed' => [], ]; foreach ($drawIds as $drawId) { try { $draw = \App\Models\Draw::findOrFail($drawId); $this->service->destroy($draw); $results['success'][] = $drawId; } catch (\RuntimeException $e) { $results['failed'][] = [ 'id' => $drawId, 'reason' => match ($e->getMessage()) { 'draw_not_deletable' => trans('api.draw_not_deletable'), 'draw_has_bets' => trans('api.draw_has_bets'), 'draw_result_exists' => trans('api.draw_result_exists'), default => trans('api.client_error'), }, ]; } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) { $results['failed'][] = [ 'id' => $drawId, 'reason' => trans('api.draw_not_found'), ]; } } return ApiResponse::success($results); } }