* Refactor notifications to allow easier plugins * Notification refactoring * Formatting * Move news to NewsService; cleanup of events * More refactoring; added send email out for news item and the template * Formatting * Formatting
40 lines
764 B
PHP
40 lines
764 B
PHP
<?php
|
|
|
|
namespace App\Notifications\Messages;
|
|
|
|
use App\Models\User;
|
|
use App\Notifications\BaseNotification;
|
|
use App\Notifications\Channels\MailChannel;
|
|
|
|
class UserRegistered extends BaseNotification
|
|
{
|
|
use MailChannel;
|
|
|
|
private $user;
|
|
|
|
/**
|
|
* Create a new notification instance.
|
|
*
|
|
* @param \App\Models\User $user
|
|
*/
|
|
public function __construct(User $user)
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->user = $user;
|
|
|
|
$this->setMailable(
|
|
'Welcome to '.config('app.name').'!',
|
|
'notifications.mail.user.registered',
|
|
['user' => $this->user]
|
|
);
|
|
}
|
|
|
|
public function toArray($notifiable)
|
|
{
|
|
return [
|
|
'user_id' => $this->user->id,
|
|
];
|
|
}
|
|
}
|