ctrlpanel/app/Notifications/ReferralNotification.php
Shift 70208d2157
Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
2023-01-05 17:01:42 +00:00

59 lines
1.4 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class ReferralNotification extends Notification
{
use Queueable;
/**
* @var User
*/
private $user;
/**
* Create a new notification instance.
*
* @param User $user
*/
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
* @return array
*/
public function via($notifiable)
{
return ['database'];
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
'title' => __('Someone registered using your Code!'),
'content' => '
<p>You received '.config('SETTINGS::REFERRAL::REWARD').' '.config('SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME').'</p>
<p>because '.$this->ref_user->name.' registered with your Referral-Code!</p>
<p>Thank you very much for supporting us!.</p>
<p>'.config('app.name', 'Laravel').'</p>
',
];
}
}