refactor: move backend in apps/backend
This commit is contained in:
1 parent
cf529278bd
commit
e2b471312c
178 files changed
+210
-193
No files matched your search
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace apps\backend\app\Notifications;
|
||||
|
||||
use apps\backend\app\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Notifications\Messages\BroadcastMessage;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class UserRegistered extends Notification implements ShouldBroadcast
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(public User $user) {}
|
||||
|
||||
public function via($notifiable): array
|
||||
{
|
||||
$channels = [];
|
||||
|
||||
if ($notifiable->web_notifications) {
|
||||
$channels[] = 'database';
|
||||
$channels[] = 'broadcast';
|
||||
}
|
||||
|
||||
return $channels;
|
||||
}
|
||||
|
||||
public function toDatabase($notifiable): array
|
||||
{
|
||||
return [
|
||||
'message' => "Nouvelle demande d'inscription : {$this->user->name} {$this->user->lastname}",
|
||||
'user_id' => $this->user->id,
|
||||
];
|
||||
}
|
||||
|
||||
public function toBroadcast($notifiable): BroadcastMessage
|
||||
{
|
||||
return new BroadcastMessage($this->toDatabase($notifiable));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user