Add sports-match type, device tracking, profile visits, and share refactor
- New SportsMatch model/controller and sports UI components/modal - Move share-modal to a reusable x-share-modal/x-share-button component - Add VideoSharedWithUser notification and share-to-members flow - Device/user-agent tracking on views, downloads, share accesses - ProfileVisit model + migration; subscription source tracking - Email thumbnail support; remove stale TODO files
This commit is contained in:
1 parent
6aae6f86b6
commit
73527f3781
61 files changed
+4014
-636
No files matched your search
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Models\Video;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class VideoSharedWithUser extends Notification
|
||||
{
|
||||
public function __construct(
|
||||
public Video $video,
|
||||
public User $sharer,
|
||||
public ?string $message,
|
||||
public string $shareUrl,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* A direct, person-to-person share is transactional — always deliver both
|
||||
* the in-app notification and the email (not gated by subscription prefs).
|
||||
*/
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['database', 'mail'];
|
||||
}
|
||||
|
||||
public function toArray(object $notifiable): array
|
||||
{
|
||||
return [
|
||||
'type' => 'video_shared',
|
||||
'video_id' => $this->video->id,
|
||||
'video_route_key' => $this->video->getRouteKey(),
|
||||
'video_title' => $this->video->title,
|
||||
'video_thumbnail' => $this->video->thumbnail,
|
||||
'actor_id' => $this->sharer->id,
|
||||
'actor_name' => $this->sharer->name,
|
||||
'actor_avatar' => $this->sharer->avatar_url,
|
||||
'message' => $this->message,
|
||||
];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
$isSong = $this->video->isAudioOnly() || $this->video->type === 'music';
|
||||
$noun = $isSong ? 'song' : ($this->video->type === 'match' ? 'match' : 'video');
|
||||
|
||||
return (new MailMessage)
|
||||
->subject($this->sharer->name . ' shared a ' . $noun . ' with you')
|
||||
->view('emails.video-shared', [
|
||||
'video' => $this->video,
|
||||
'sender' => $this->sharer,
|
||||
'shareUrl' => $this->shareUrl,
|
||||
'personalMessage' => $this->message,
|
||||
'shareTitle' => $this->video->title,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user