fixed installation user assign company..
This commit is contained in:
parent
1b4fb495db
commit
93a23d9399
@ -52,14 +52,18 @@ class CreateUser extends Job
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->request->has('companies')) {
|
if ($this->request->has('companies')) {
|
||||||
$user = user();
|
if (request()->isNotInstall()) {
|
||||||
|
$user = user();
|
||||||
|
|
||||||
$companies = $user->withoutEvents(function () use ($user) {
|
$companies = $user->withoutEvents(function () use ($user) {
|
||||||
return $user->companies()->whereIn('id', $this->request->get('companies'))->pluck('id');
|
return $user->companies()->whereIn('id', $this->request->get('companies'))->pluck('id');
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($companies->isNotEmpty()) {
|
if ($companies->isNotEmpty()) {
|
||||||
$this->user->companies()->attach($companies->toArray());
|
$this->user->companies()->attach($companies->toArray());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->user->companies()->attach($this->request->get('companies'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user