Save workspace changes
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\Artwork;
|
||||
use App\Models\Post;
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class ArtworkSharedNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public function __construct(
|
||||
public readonly Post $post,
|
||||
public readonly Artwork $artwork,
|
||||
public readonly User $sharer,
|
||||
) {}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database'];
|
||||
}
|
||||
|
||||
public function databaseType(object $notifiable): string
|
||||
{
|
||||
return 'artwork_shared';
|
||||
}
|
||||
|
||||
public function toDatabase(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'type' => 'artwork_shared',
|
||||
'post_id' => $this->post->id,
|
||||
'artwork_id' => $this->artwork->id,
|
||||
'artwork_title' => $this->artwork->title,
|
||||
'sharer_id' => $this->sharer->id,
|
||||
'sharer_name' => $this->sharer->name,
|
||||
'sharer_username' => $this->sharer->username,
|
||||
'message' => $this->sharer->name . ' shared your artwork "' . $this->artwork->title . '"',
|
||||
'url' => "/@{$this->sharer->username}/posts",
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user