File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
packages/Webkul/Admin/src/Http/Controllers/Activity Expand file tree Collapse file tree 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
146146
147147 $ activity = $ this ->activityRepository ->update ($ data , $ id );
148148
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+ }
154161
155162 Event::dispatch ('activity.update.after ' , $ activity );
156163
You can’t perform that action at this time.
0 commit comments