391 Notification refactorings (#441)
* 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
This commit is contained in:
39
app/Notifications/Messages/UserRegistered.php
Normal file
39
app/Notifications/Messages/UserRegistered.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user