Skip to content

Commit efd80f4

Browse files
fix: activity issue fixed
1 parent 192908b commit efd80f4

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

packages/Webkul/Admin/src/Http/Controllers/Activity/ActivityController.php

+12-5
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)