Initialer Laravel Commit für BetiX
This commit is contained in:
45
app/Notifications/FriendRequestNotification.php
Normal file
45
app/Notifications/FriendRequestNotification.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class FriendRequestNotification extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public int $senderId;
|
||||
public string $senderUsername;
|
||||
public ?string $senderAvatar;
|
||||
public int $friendRequestId;
|
||||
|
||||
public function __construct(int $senderId, string $senderUsername, ?string $senderAvatar, int $friendRequestId)
|
||||
{
|
||||
$this->senderId = $senderId;
|
||||
$this->senderUsername = $senderUsername;
|
||||
$this->senderAvatar = $senderAvatar;
|
||||
$this->friendRequestId = $friendRequestId;
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database'];
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'kind' => 'friend_request',
|
||||
'icon' => 'user-plus',
|
||||
'title' => 'Friend request',
|
||||
'desc' => $this->senderUsername.' sent you a friend request',
|
||||
'sender' => [
|
||||
'id' => $this->senderId,
|
||||
'username' => $this->senderUsername,
|
||||
'avatar' => $this->senderAvatar,
|
||||
],
|
||||
'friend_request_id' => $this->friendRequestId,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user