ctrlpanel/app/Notifications/WelcomeMessage.php

102 lines
3.8 KiB
PHP
Raw Normal View History

2021-06-05 09:26:32 +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\UserSettings;
2021-06-05 09:26:32 +00:00
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
2021-06-05 09:26:32 +00:00
use Illuminate\Notifications\Notification;
class WelcomeMessage extends Notification implements ShouldQueue
2021-06-05 09:26:32 +00:00
{
use Queueable;
/**
* @var User
*/
private $user;
2023-02-06 20:16:54 +00:00
private $credits_display_name;
private $credits_reward_after_verify_discord;
private $credits_reward_after_verify_email;
private $server_limit_after_verify_discord;
private $server_limit_after_verify_email;
2021-06-05 09:26:32 +00:00
/**
* Create a new notification instance.
*
* @param User $user
2021-06-05 09:26:32 +00:00
*/
2023-02-06 20:16:54 +00:00
public function __construct(User $user, GeneralSettings $general_settings, UserSettings $user_settings)
2021-06-05 09:26:32 +00:00
{
$this->user = $user;
2023-02-06 20:16:54 +00:00
$this->credits_display_name = $general_settings->credits_display_name;
$this->credits_reward_after_verify_discord = $user_settings->credits_reward_after_verify_discord;
$this->credits_reward_after_verify_email = $user_settings->credits_reward_after_verify_email;
$this->server_limit_after_verify_discord = $user_settings->server_limit_after_verify_discord;
$this->server_limit_after_verify_email = $user_settings->server_limit_after_verify_email;
2021-06-05 09:26:32 +00:00
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
2021-06-05 09:26:32 +00:00
* @return array
*/
public function via($notifiable)
{
return ['database'];
}
public function AdditionalLines()
{
$AdditionalLine = '';
2023-02-06 20:16:54 +00:00
if ($this->credits_reward_after_verify_email != 0) {
$AdditionalLine .= __('Verifying your e-mail address will grant you ').$this->credits_reward_after_verify_email.' '.__('additional').' '.$this->credits_display_name.'. <br />';
}
2023-02-06 20:16:54 +00:00
if ($this->server_limit_after_verify_email != 0) {
$AdditionalLine .= __('Verifying your e-mail will also increase your Server Limit by ').$this->server_limit_after_verify_email.'. <br />';
}
$AdditionalLine .= '<br />';
2023-02-06 20:16:54 +00:00
if ($this->credits_reward_after_verify_discord != 0) {
$AdditionalLine .= __('You can also verify your discord account to get another ').$this->credits_reward_after_verify_discord.' '.$this->credits_display_name.'. <br />';
}
2023-02-06 20:16:54 +00:00
if ($this->server_limit_after_verify_discord != 0) {
$AdditionalLine .= __('Verifying your Discord account will also increase your Server Limit by ').$this->server_limit_after_verify_discord.'. <br />';
}
return $AdditionalLine;
}
2021-10-26 12:13:42 +00:00
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
2021-10-26 12:13:42 +00:00
* @return array
*/
public function toArray($notifiable)
{
2021-06-05 09:26:32 +00:00
return [
'title' => __('Getting started!'),
'content' => '
<p> '.__('Hello')." <strong>{$this->user->name}</strong>, ".__('Welcome to our dashboard').'!</p>
<h5>'.__('Verification').'</h5>
<p>'.__('You can verify your e-mail address and link/verify your Discord account.').'</p>
2021-10-13 21:26:18 +00:00
<p>
'.$this->AdditionalLines().'
</p>
<h5>'.__('Information').'</h5>
<p>'.__('This dashboard can be used to create and delete servers').'.<br /> '.__('These servers can be used and managed on our pterodactyl panel').'.<br /> '.__('If you have any questions, please join our Discord server and #create-a-ticket').'.</p>
<p>'.__('We hope you can enjoy this hosting experience and if you have any suggestions please let us know').'!</p>
<p>'.__('Regards').',<br />'.config('app.name', 'Laravel').'</p>
',
2021-06-05 09:26:32 +00:00
];
}
}