Save workspace changes
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\Post;
|
||||
use App\Models\PostComment;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class PostCommentedNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
public readonly Post $post,
|
||||
public readonly PostComment $comment,
|
||||
public readonly User $commenter,
|
||||
) {}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database'];
|
||||
}
|
||||
|
||||
public function databaseType(object $notifiable): string
|
||||
{
|
||||
return 'post_commented';
|
||||
}
|
||||
|
||||
public function toDatabase(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'type' => 'post_commented',
|
||||
'post_id' => $this->post->id,
|
||||
'comment_id' => $this->comment->id,
|
||||
'commenter_id' => $this->commenter->id,
|
||||
'commenter_name' => $this->commenter->name,
|
||||
'commenter_username' => $this->commenter->username,
|
||||
'message' => "{$this->commenter->name} commented on your post",
|
||||
'url' => "/@{$this->post->user->username}/posts",
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user