-
app/Notifications/AccountCreated.php
Open in GitHubuse Pterodactyl\Models\User; use Illuminate\Notifications\Notification; use Illuminate\Notifications\Messages\MailMessage; class AccountCreated extends Notification { // public function via($notifiable) { return ['mail']; } public function toMail($notifiable) { $message = (new MailMessage()) ->greeting('Hello ' . $this->user->name . '!') ->line('You are receiving this email because an account has been created for you on ' . config('app.name') . '.') ->line('Username: ' . $this->user->username) ->line('Email: ' . $this->user->email); if (!is_null($this->token)) { return $message->action('Setup Your Account', url('/auth/password/reset/' . $this->token . '?email=' . urlencode($this->user->email))); } return $message; } }
-
app/Services/Users/UserCreationService.php
Open in GitHubuse Pterodactyl\Notifications\AccountCreated; use Pterodactyl\Contracts\Repository\UserRepositoryInterface; class UserCreationService { public function handle(array $data) { // $user = $this->repository->create(array_merge($data, [ 'uuid' => Uuid::uuid4()->toString(), ]), true, true); // $this->connection->commit(); $user->notify(new AccountCreated($user, $token ?? null)); // } }