fixed tests

This commit is contained in:
Denis Duliçi 2021-05-15 10:00:14 +03:00
parent 93a23d9399
commit 43c32b7b58
2 changed files with 13 additions and 9 deletions

View File

@ -52,7 +52,9 @@ class CreateUser extends Job
}
if ($this->request->has('companies')) {
if (request()->isNotInstall()) {
if (app()->runningInConsole() || request()->isInstall()) {
$this->user->companies()->attach($this->request->get('companies'));
} else {
$user = user();
$companies = $user->withoutEvents(function () use ($user) {
@ -62,8 +64,6 @@ class CreateUser extends Job
if ($companies->isNotEmpty()) {
$this->user->companies()->attach($companies->toArray());
}
} else {
$this->user->companies()->attach($this->request->get('companies'));
}
}

View File

@ -53,6 +53,9 @@ class UpdateUser extends Job
}
if ($this->request->has('companies')) {
if (app()->runningInConsole() || request()->isInstall()) {
$this->user->companies()->attach($this->request->get('companies'));
} else {
$user = user();
$companies = $user->withoutEvents(function () use ($user) {
@ -63,6 +66,7 @@ class UpdateUser extends Job
$this->user->companies()->sync($companies->toArray());
}
}
}
if ($this->user->contact) {
$this->user->contact->update($this->request->input());