From 57380d93baf57bfdb8067e96c68ba72e4e993d96 Mon Sep 17 00:00:00 2001 From: Gary Lamp Date: Mon, 26 Nov 2018 11:46:14 +0700 Subject: [PATCH] Fix call operator in chat - Use Psid instead of app id - Fix the variables --- src/Shared/CanLearn.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Shared/CanLearn.php b/src/Shared/CanLearn.php index 1289d05..fda263e 100644 --- a/src/Shared/CanLearn.php +++ b/src/Shared/CanLearn.php @@ -65,15 +65,13 @@ public function says($messages, $attributes = [], $lead_ids = null) if ( ! is_null($lead_ids)) { $lead_ids = (array) $lead_ids; - - $leads = Lead::withTrashed()->whereIn('id', $lead_ids)->get(); + $leads = Lead::withTrashed()->whereIn('user_id', $lead_ids)->get(); if (empty($leads) || $leads === null) { return; } - $leads->each(function ($lead) { - Conversation::set('lead', $lead); + $leads->each(function ($lead) use ($messages, $attributes) { $this->request->sendMessages($messages, $attributes, $lead); }); } else { @@ -215,4 +213,4 @@ public function simulate($input) { // Todo: Add simulate method to make app more easy to test } -} \ No newline at end of file +}