From aa1789166d1a0c06359a9f04adbfb3923cc57a6b Mon Sep 17 00:00:00 2001 From: Dave Date: Fri, 11 Mar 2016 12:33:45 +0000 Subject: [PATCH] - Fix bug where affiliate stat updates were applying to multiple events --- app/Http/Controllers/EventCheckoutController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/EventCheckoutController.php b/app/Http/Controllers/EventCheckoutController.php index e66f390c..260f5f6f 100644 --- a/app/Http/Controllers/EventCheckoutController.php +++ b/app/Http/Controllers/EventCheckoutController.php @@ -313,7 +313,8 @@ class EventCheckoutController extends Controller * Update affiliates stats stats */ if ($ticket_order['affiliate_referral']) { - $affiliate = Affiliate::where('name', '=', $ticket_order['affiliate_referral'])->first(); + $affiliate = Affiliate::where('name', '=', $ticket_order['affiliate_referral']) + ->where('event_id', '=', $event_id)->first(); $affiliate->increment('sales_volume', $order->amount + $order->organiser_booking_fee); $affiliate->increment('tickets_sold', $ticket_order['total_ticket_quantity']); }