ctrlpanel/app/Notifications/ReferralNotification.php

63 lines
1.5 KiB
PHP
Raw Normal View History

2022-06-02 14:11:24 +00:00
<?php
namespace App\Notifications;
use App\Models\User;
2023-02-06 20:16:54 +00:00
use App\Settings\GeneralSettings;
use App\Settings\ReferralSettings;
2022-06-02 14:11:24 +00:00
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class ReferralNotification extends Notification
{
use Queueable;
2022-06-02 14:11:24 +00:00
/**
* @var User
*/
private $user;
2023-02-06 20:16:54 +00:00
private $ref_user;
2022-06-02 14:11:24 +00:00
/**
* Create a new notification instance.
*
* @param User $user
2022-06-02 14:11:24 +00:00
*/
public function __construct(int $user, int $ref_user)
{
$this->user = User::findOrFail($user);
$this->ref_user = User::findOrFail($ref_user);
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
2022-06-02 14:11:24 +00:00
* @return array
*/
public function via($notifiable)
{
return ['database'];
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
2022-06-02 14:11:24 +00:00
* @return array
*/
2023-02-06 20:16:54 +00:00
public function toArray($notifiable, GeneralSettings $general_settings, ReferralSettings $referral_settings)
2022-06-02 14:11:24 +00:00
{
return [
'title' => __('Someone registered using your Code!'),
'content' => '
2023-02-06 20:16:54 +00:00
<p>You received '. $referral_settings->reward . ' ' . $general_settings->credits_display_name . '</p>
<p>because ' . $this->ref_user->name . ' registered with your Referral-Code!</p>
2022-06-02 14:11:24 +00:00
<p>Thank you very much for supporting us!.</p>
<p>'.config('app.name', 'Laravel').'</p>
',
2022-06-02 14:11:24 +00:00
];
}
}