New POST /videos/{video}/share/email route (auth + throttled) handled by
VideoController@shareByEmail, sending the VideoShared mailable rendered from
emails/video-shared.blade.php. Wired into the share modal and video-actions.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
70 lines
2.9 KiB
PHP
70 lines
2.9 KiB
PHP
@php
|
|
// Type-aware wording — a sport/match or regular video is NOT a song.
|
|
$isSong = $video->isAudioOnly() || $video->type === 'music';
|
|
$noun = $isSong ? 'song' : ($video->type === 'match' ? 'match' : 'video');
|
|
$cta = $isSong ? 'Listen now' : 'Watch now';
|
|
$icon = $isSong ? '🎵' : '▶'; // 🎵 vs ▶
|
|
$byLabel = $isSong ? 'Artist' : ($video->type === 'match' ? 'Posted by' : 'Channel');
|
|
@endphp
|
|
<x-emails.layout subject="{{ $sender->name }} shared a {{ $noun }} with you">
|
|
|
|
{{-- Icon --}}
|
|
<div style="width:64px;height:64px;border-radius:50%;background:rgba(230,30,30,.12);border:1px solid rgba(230,30,30,.25);margin:0 auto 24px;text-align:center;line-height:64px;font-size:28px;">{!! $icon !!}</div>
|
|
|
|
<h1 class="email-title">{{ $sender->name }} shared a {{ $noun }} with you</h1>
|
|
<p class="email-subtitle">They thought you'd enjoy this on {{ config('app.name') }}.</p>
|
|
|
|
@if($personalMessage)
|
|
{{-- Personal note --}}
|
|
<div class="email-infobox" style="border-left:3px solid #e61e1e;">
|
|
<div class="email-infobox-label">Message from {{ $sender->name }}</div>
|
|
<div style="color:#ddd;font-size:14px;line-height:1.6;white-space:pre-wrap;">{{ $personalMessage }}</div>
|
|
</div>
|
|
@endif
|
|
|
|
{{-- Cover --}}
|
|
<div class="email-thumb-wrap">
|
|
@if($video->thumbnail)
|
|
<a href="{{ $shareUrl }}">
|
|
<img src="{{ route('media.thumbnail', $video->thumbnail) }}" alt="{{ $shareTitle }}">
|
|
</a>
|
|
@else
|
|
<div class="email-thumb-placeholder">
|
|
<span style="font-size:32px;">{!! $icon !!}</span>
|
|
<span>{{ Str::limit($shareTitle, 40) }}</span>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- Details --}}
|
|
<div class="email-infobox">
|
|
<div class="email-infobox-label">Details</div>
|
|
<div class="email-inforow">
|
|
<span class="email-inforow-key">Title</span>
|
|
<span class="email-inforow-val">{{ $shareTitle }}</span>
|
|
</div>
|
|
@if($video->formatted_duration)
|
|
<div class="email-inforow">
|
|
<span class="email-inforow-key">Duration</span>
|
|
<span class="email-inforow-val">{{ $video->formatted_duration }}</span>
|
|
</div>
|
|
@endif
|
|
<div class="email-inforow">
|
|
<span class="email-inforow-key">{{ $byLabel }}</span>
|
|
<span class="email-inforow-val">{{ $video->user->name ?? config('app.name') }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- CTA --}}
|
|
<div class="email-btn-wrap">
|
|
<a href="{{ $shareUrl }}" class="email-btn">{!! $isSong ? '▶ ' : '▶ ' !!}{{ $cta }}</a>
|
|
</div>
|
|
|
|
<hr class="email-divider">
|
|
|
|
<p class="email-note">
|
|
{{ $sender->name }} sent you this link from {{ config('app.name') }}. If you weren't expecting it, you can safely ignore this email.
|
|
</p>
|
|
|
|
</x-emails.layout>
|