When a new user registers, all super_admin users receive:
- A database notification shown in the bell (type: new_user), with the
new user's avatar and a link to their channel
- An email congratulating them with the new member's name, email,
join date, gender, and nationality, plus a View Profile CTA
Notification rendering in app.blade.php refactored into notifHref() and
notifThumb() helpers so new_user notifications link to /channel/{slug}
and show a circular avatar instead of a video thumbnail. Also fixed the
legacy /storage/thumbnails/ path to /media/thumbnails/ for video notifications.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Notifications\Notification;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
class NewUserRegistered extends Notification
|
|
{
|
|
public function __construct(public User $newUser) {}
|
|
|
|
public function via(object $notifiable): array
|
|
{
|
|
return ['database', 'mail'];
|
|
}
|
|
|
|
public function toArray(object $notifiable): array
|
|
{
|
|
return [
|
|
'type' => 'new_user',
|
|
'user_id' => $this->newUser->id,
|
|
'user_name' => $this->newUser->name,
|
|
'user_email' => $this->newUser->email,
|
|
'user_avatar' => $this->newUser->avatar_url,
|
|
'user_channel' => $this->newUser->channel,
|
|
];
|
|
}
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
{
|
|
return (new MailMessage)
|
|
->subject('New member joined TAKEONE 🎉')
|
|
->view('emails.new-user-registered', [
|
|
'newUser' => $this->newUser,
|
|
'admin' => $notifiable,
|
|
]);
|
|
}
|
|
}
|