Files
investbrain/app/Notifications/InvitedOnboardingNotification.php
T

65 lines
2.1 KiB
PHP
Raw Permalink Normal View History

2024-10-22 17:39:42 -05:00
<?php
namespace App\Notifications;
use App\Models\User;
use App\Models\Portfolio;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
2024-10-22 20:29:54 -05:00
class InvitedOnboardingNotification extends Notification implements ShouldQueue
2024-10-22 17:39:42 -05:00
{
use Queueable;
/**
* Create a new notification instance.
*/
public function __construct(
public Portfolio $portfolio,
public User $sender,
) { }
/**
* Get the notification's delivery channels.
*
* @return array<int, string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*/
public function toMail(object $notifiable): MailMessage
{
2024-10-22 20:29:54 -05:00
$url = url()->signedRoute('invited_onboarding', ['portfolio' => $this->portfolio->id, 'user' => $notifiable->id], now()->addDays(90));
2024-10-22 17:39:42 -05:00
return (new MailMessage)
->replyTo($this->sender->email, $this->sender->name)
->greeting('Hey there! 👋')
2024-10-22 20:29:54 -05:00
->subject("You've been invited to {$this->portfolio->title} on Investbrain!")
2024-10-25 21:32:17 -05:00
->line("{$this->sender->name} has invited you to **{$this->portfolio->title}** on Investbrain, a smart open-source investment tracker that consolidates and monitors market performance across your different brokerages.")
2024-10-22 20:29:54 -05:00
->line("Once you're in, you'll be able to see all the holdings, dividends, market performance and more for {$this->portfolio->title}!")
->action("Get Started", $url)
2024-10-22 17:39:42 -05:00
->line("If you have any questions, you can reply to this email.")
->salutation("See you there,\n". e($this->sender->name));
}
/**
* Get the array representation of the notification.
*
* @return array<string, mixed>
*/
public function toArray(object $notifiable): array
{
return [
//
];
}
}