fixed tests
This commit is contained in:
parent
93a23d9399
commit
43c32b7b58
@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,14 +53,18 @@ class UpdateUser extends Job
|
||||
}
|
||||
|
||||
if ($this->request->has('companies')) {
|
||||
$user = user();
|
||||
if (app()->runningInConsole() || request()->isInstall()) {
|
||||
$this->user->companies()->attach($this->request->get('companies'));
|
||||
} else {
|
||||
$user = user();
|
||||
|
||||
$companies = $user->withoutEvents(function () use ($user) {
|
||||
return $user->companies()->whereIn('id', $this->request->get('companies'))->pluck('id');
|
||||
});
|
||||
$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 ($companies->isNotEmpty()) {
|
||||
$this->user->companies()->sync($companies->toArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user