WelcomeMessage.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace App\Notifications;
  3. use App\Models\Configuration;
  4. use App\Models\User;
  5. use Illuminate\Bus\Queueable;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Illuminate\Notifications\Notification;
  8. class WelcomeMessage extends Notification implements ShouldQueue
  9. {
  10. use Queueable;
  11. /**
  12. * @var User
  13. */
  14. private $user;
  15. /**
  16. * Create a new notification instance.
  17. *
  18. * @param User $user
  19. */
  20. public function __construct(User $user)
  21. {
  22. $this->user = $user;
  23. }
  24. /**
  25. * Get the notification's delivery channels.
  26. *
  27. * @param mixed $notifiable
  28. * @return array
  29. */
  30. public function via($notifiable)
  31. {
  32. return ['database'];
  33. }
  34. public function AdditionalLines()
  35. {
  36. $AdditionalLine = "";
  37. if(Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_EMAIL') != 0) {
  38. $AdditionalLine .= "Verifying your e-mail address will grant you ".Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_EMAIL')." additional " . Configuration::getValueByKey('CREDITS_DISPLAY_NAME') . ". <br />";
  39. }
  40. if(Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') != 0) {
  41. $AdditionalLine .= "Verifying your e-mail will also increase your Server Limit by " . Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL') . ". <br />";
  42. }
  43. $AdditionalLine .="<br />";
  44. if(Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_DISCORD') != 0) {
  45. $AdditionalLine .= "You can also verify your discord account to get another " . Configuration::getValueByKey('CREDITS_REWARD_AFTER_VERIFY_DISCORD') . " " . Configuration::getValueByKey('CREDITS_DISPLAY_NAME') . ". <br />";
  46. }
  47. if(Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') != 0) {
  48. $AdditionalLine .= "Verifying your Discord account will also increase your Server Limit by " . Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD') . ". <br />";
  49. }
  50. return $AdditionalLine;
  51. }
  52. /**
  53. * Get the array representation of the notification.
  54. *
  55. * @param mixed $notifiable
  56. * @return array
  57. */
  58. public function toArray($notifiable)
  59. {
  60. return [
  61. 'title' => "Getting started!",
  62. 'content' => "
  63. <p>Hello <strong>{$this->user->name}</strong>, Welcome to our dashboard!</p>
  64. <h5>Verification</h5>
  65. <p>You can verify your e-mail address and link/verify your Discord account.</p>
  66. <p>
  67. ".$this->AdditionalLines()."
  68. </p>
  69. <h5>Information</h5>
  70. <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>
  71. <p>We hope you can enjoy this hosting experience and if you have any suggestions please let us know!</p>
  72. <p>Regards,<br />" . config('app.name', 'Laravel') . "</p>
  73. ",
  74. ];
  75. }
  76. }