fixed installation user assign company..

This commit is contained in:
Cüneyt Şentürk 2021-05-14 20:43:17 +03:00
parent 1b4fb495db
commit 93a23d9399

View File

@ -52,14 +52,18 @@ class CreateUser extends Job
}
if ($this->request->has('companies')) {
$user = user();
if (request()->isNotInstall()) {
$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()->attach($companies->toArray());
if ($companies->isNotEmpty()) {
$this->user->companies()->attach($companies->toArray());
}
} else {
$this->user->companies()->attach($this->request->get('companies'));
}
}