several fixes

This commit is contained in:
Denis Duliçi
2021-05-14 18:29:24 +03:00
parent 7ac53681ff
commit b8057a7a12
19 changed files with 165 additions and 75 deletions

View File

@ -53,7 +53,15 @@ class UpdateUser extends Job
}
if ($this->request->has('companies')) {
$this->user->companies()->sync($this->request->get('companies'));
$user = user();
$companies = $user->withoutEvents(function () use ($user) {
return $user->companies()->whereIn('id', $this->request->get('companies'))->pluck('id');
});
if ($companies->isNotEmpty()) {
$this->user->companies()->sync($companies->toArray());
}
}
if ($this->user->contact) {