1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Mail/Admin/AccountCreatedObject.php

55 lines
1.6 KiB
PHP
Raw Normal View History

2021-02-14 12:36:36 +01:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
2021-02-14 12:36:36 +01:00
*
2021-06-16 08:58:16 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2021-02-14 12:36:36 +01:00
*/
namespace App\Mail\Admin;
2023-06-07 09:22:50 +02:00
use App\Models\User;
2021-06-29 11:46:40 +02:00
use App\Utils\Ninja;
2023-06-07 09:22:50 +02:00
use App\Models\Company;
2021-06-29 11:46:40 +02:00
use Illuminate\Support\Facades\App;
2021-02-14 12:36:36 +01:00
class AccountCreatedObject
{
2023-06-07 09:22:50 +02:00
public function __construct(public User $user, public Company $company)
2021-02-14 12:36:36 +01:00
{
}
public function build()
{
2021-06-29 11:46:40 +02:00
App::forgetInstance('translator');
/* Init a new copy of the translator*/
$t = app('translator');
/* Set the locale*/
App::setLocale($this->company->getLocale());
/* Set customized translations _NOW_ */
$t->replace(Ninja::transformTranslations($this->company->settings));
2021-02-14 12:36:36 +01:00
$data = [
'title' => ctrans('texts.new_signup'),
'message' => ctrans('texts.new_signup_text', ['user' => $this->user->present()->name(), 'email' => $this->user->email, 'ip' => $this->user->ip]),
'url' => config('ninja.web_url'),
'button' => ctrans('texts.account_login'),
'signature' => $this->company->settings->email_signature,
'settings' => $this->company->settings,
'logo' => $this->company->present()->logo(),
];
$mail_obj = new \stdClass;
$mail_obj->subject = ctrans('texts.new_signup');
$mail_obj->data = $data;
$mail_obj->markdown = 'email.admin.generic';
$mail_obj->tag = $this->company->company_key;
return $mail_obj;
}
}