-
-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathLicenseKeyGenerated.php
More file actions
64 lines (56 loc) · 2.34 KB
/
LicenseKeyGenerated.php
File metadata and controls
64 lines (56 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace App\Notifications;
use App\Enums\Subscription;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class LicenseKeyGenerated extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
public string $licenseKey,
public ?Subscription $subscription = null,
public ?string $firstName = null,
) {}
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
$greeting = $this->firstName
? "{$this->firstName}, your license is ready!"
: 'Your license is ready!';
return (new MailMessage)
->subject('Your NativePHP License Key')
->greeting($greeting)
->line('Thank you for purchasing a license for the early access program of mobile NativePHP.')
->line('Your license key is:')
->line("**{$this->licenseKey}**")
->line('When prompted by Composer, use your email address as the username and this license key as the password.')
->action('View Installation Guide', url('/docs/mobile/1/getting-started/installation'))
->line('If you need to manage your subscription for this license, you can do so on [Stripe](https://billing.stripe.com/p/login/4gwaGV5VK0uU44E288).')
->line("If you have any questions, please don't hesitate to reach out to our support team.")
->lineIf($this->subscription === Subscription::Max, 'As a Max subscriber, you also have access to the NativePHP/mobile repository. To access it, please log in to [Anystack.sh](https://auth.anystack.sh/?accountType=customer) using the same email address you used for your purchase.')
->salutation("Happy coding!\n\nThe NativePHP Team")
->success();
}
/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
return [
'license_key' => $this->licenseKey,
'firstName' => $this->firstName,
];
}
}