user invitation send mail control method changes..

This commit is contained in:
Cüneyt Şentürk 2022-07-28 17:31:34 +03:00
parent a69e1f470d
commit 5277d77c0a

View File

@ -19,7 +19,7 @@ class CreateUser extends Job implements HasOwner, HasSource, ShouldCreate
event(new UserCreating($this->request));
\DB::transaction(function () {
if (! app()->runningInConsole() && ! request()->isInstall()) {
if (empty($this->request->get('password', false))) {
$this->request->merge(['password' => Str::random(40)]);
}
@ -71,7 +71,7 @@ class CreateUser extends Job implements HasOwner, HasSource, ShouldCreate
]);
}
if ((! app()->runningInConsole() && ! request()->isInstall()) || app()->runningUnitTests()) {
if ($this->shouldSendInvitation()) {
$this->dispatch(new CreateInvitation($this->model));
}
});
@ -80,4 +80,17 @@ class CreateUser extends Job implements HasOwner, HasSource, ShouldCreate
return $this->model;
}
protected function shouldSendInvitation()
{
if (app()->runningInConsole()) {
return false;
}
if (request()->isInstall()) {
return false;
}
return true;
}
}