2021-03-31 18:10:44 +02: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-03-31 18:10:44 +02:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2021-03-31 18:10:44 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Mail;
|
|
|
|
|
2021-06-03 01:50:31 +02:00
|
|
|
use App\Models\Company;
|
2021-03-31 18:10:44 +02:00
|
|
|
use App\Utils\ClientPortal\MagicLink;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Mail\Mailable;
|
|
|
|
use Illuminate\Queue\SerializesModels;
|
2022-01-15 05:07:40 +01:00
|
|
|
use Illuminate\Support\Facades\App;
|
2021-03-31 18:10:44 +02:00
|
|
|
|
|
|
|
class ContactPasswordlessLogin extends Mailable
|
|
|
|
{
|
2021-06-09 17:07:41 +02:00
|
|
|
/** @var string */
|
2021-03-31 18:10:44 +02:00
|
|
|
public $email;
|
|
|
|
|
2021-06-09 17:07:41 +02:00
|
|
|
/** @var string */
|
2021-06-02 13:04:50 +02:00
|
|
|
public $url;
|
2021-06-03 01:50:31 +02:00
|
|
|
|
2021-06-09 17:07:41 +02:00
|
|
|
/** @var Company */
|
|
|
|
public $company;
|
|
|
|
|
2021-03-31 18:10:44 +02:00
|
|
|
/**
|
|
|
|
* Create a new message instance.
|
|
|
|
*
|
|
|
|
* @param string $email
|
|
|
|
* @param string $redirect
|
|
|
|
*/
|
2021-06-09 17:07:41 +02:00
|
|
|
public function __construct(string $email, Company $company, string $redirect = '')
|
2021-03-31 18:10:44 +02:00
|
|
|
{
|
|
|
|
$this->email = $email;
|
|
|
|
|
2021-06-09 17:07:41 +02:00
|
|
|
$this->company = $company;
|
|
|
|
|
|
|
|
$this->url = MagicLink::create($email, $company->id, $redirect);
|
2021-03-31 18:10:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build the message.
|
|
|
|
*
|
|
|
|
* @return $this
|
|
|
|
*/
|
|
|
|
public function build()
|
|
|
|
{
|
2022-01-15 05:07:40 +01:00
|
|
|
App::setLocale($this->company->getLocale());
|
|
|
|
|
2021-05-20 13:37:50 +02:00
|
|
|
return $this
|
|
|
|
->subject(ctrans('texts.account_passwordless_login'))
|
2022-03-04 04:01:09 +01:00
|
|
|
->text('email.billing.passwordless-login_text')
|
2021-06-09 17:07:41 +02:00
|
|
|
->view('email.billing.passwordless-login', [
|
|
|
|
'logo' => $this->company->present()->logo(),
|
|
|
|
'settings' => $this->company->settings,
|
2021-06-12 23:12:06 +02:00
|
|
|
'company' => $this->company->settings,
|
2021-06-09 17:07:41 +02:00
|
|
|
]);
|
2021-03-31 18:10:44 +02:00
|
|
|
}
|
|
|
|
}
|