diff --git a/app/Jobs/Account/CreateAccount.php b/app/Jobs/Account/CreateAccount.php index 4dfe7e0bf2..246b323b7b 100644 --- a/app/Jobs/Account/CreateAccount.php +++ b/app/Jobs/Account/CreateAccount.php @@ -36,6 +36,7 @@ use Illuminate\Support\Facades\Cache; use Illuminate\Support\Str; use Symfony\Component\HttpFoundation\Response; use Turbo124\Beacon\Facades\LightLogs; +use Illuminate\Support\Facades\App; class CreateAccount { @@ -114,8 +115,22 @@ class CreateAccount $spaa9f78->fresh(); - if(Ninja::isHosted()) + if(Ninja::isHosted()){ +nlog("welcome"); + App::forgetInstance('translator'); + $t = app('translator'); + $t->replace(Ninja::transformTranslations($sp035a66->settings)); + + $nmo = new NinjaMailerObject; + $nmo->mailable = new \Modules\Admin\Mail\Welcome($sp035a66->owner()); + $nmo->company = $sp035a66; + $nmo->settings = $sp035a66->settings; + $nmo->to_user = $sp035a66->owner(); + + NinjaMailerJob::dispatch($nmo); + \Modules\Admin\Jobs\Account\NinjaUser::dispatch([], $sp035a66); + } VersionCheck::dispatch(); @@ -123,6 +138,9 @@ class CreateAccount ->increment() ->batch(); + + + return $sp794f3f; } diff --git a/app/Jobs/User/CreateUser.php b/app/Jobs/User/CreateUser.php index 8b767762d5..ceb9a08215 100644 --- a/app/Jobs/User/CreateUser.php +++ b/app/Jobs/User/CreateUser.php @@ -82,8 +82,7 @@ class CreateUser 'settings' => null, ]); - if(!Ninja::isSelfHost()){ - nlog("in the create user class"); + if(!Ninja::isSelfHost()) { event(new UserWasCreated($user, $user, $this->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); } diff --git a/app/Listeners/SendVerificationNotification.php b/app/Listeners/SendVerificationNotification.php index 4f6beef409..5f2d98b5a3 100644 --- a/app/Listeners/SendVerificationNotification.php +++ b/app/Listeners/SendVerificationNotification.php @@ -24,6 +24,7 @@ use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\App; +use Illuminate\Support\Carbon; class SendVerificationNotification implements ShouldQueue { @@ -53,17 +54,20 @@ class SendVerificationNotification implements ShouldQueue $event->user->service()->invite($event->company); - App::forgetInstance('translator'); - $t = app('translator'); - $t->replace(Ninja::transformTranslations($event->company->settings)); - $nmo = new NinjaMailerObject; - $nmo->mailable = new UserAdded($event->company, $event->creating_user, $event->user); - $nmo->company = $event->company; - $nmo->settings = $event->company->settings; - $nmo->to_user = $event->creating_user; - NinjaMailerJob::dispatch($nmo); + if(Carbon::parse($event->company->created_at)->lt(now()->subDay())) + { + App::forgetInstance('translator'); + $t = app('translator'); + $t->replace(Ninja::transformTranslations($event->company->settings)); + $nmo = new NinjaMailerObject; + $nmo->mailable = new UserAdded($event->company, $event->creating_user, $event->user); + $nmo->company = $event->company; + $nmo->settings = $event->company->settings; + $nmo->to_user = $event->creating_user; + NinjaMailerJob::dispatch($nmo); + } } }