File tree 1 file changed +12
-5
lines changed
packages/Webkul/Admin/src/Http/Controllers/Activity
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -146,11 +146,18 @@ public function update($id): RedirectResponse|JsonResponse
146
146
147
147
$ activity = $ this ->activityRepository ->update ($ data , $ id );
148
148
149
- $ activity ->leads ()->sync (
150
- ! empty ($ data ['lead_id ' ])
151
- ? [$ data ['lead_id ' ]]
152
- : []
153
- );
149
+ /**
150
+ * We will not use `empty` directly here because `lead_id` can be a blank string
151
+ * from the activity form. However, on the activity view page, we are only updating the
152
+ * `is_done` field, so `lead_id` will not be present in that case.
153
+ */
154
+ if (isset ($ data ['lead_id ' ])) {
155
+ $ activity ->leads ()->sync (
156
+ ! empty ($ data ['lead_id ' ])
157
+ ? [$ data ['lead_id ' ]]
158
+ : []
159
+ );
160
+ }
154
161
155
162
Event::dispatch ('activity.update.after ' , $ activity );
156
163
You can’t perform that action at this time.
0 commit comments