@include('includes.advertising')
@foreach ($updates as $response)
@php
if (auth()->check()) {
$checkUserSubscription = auth()->user()->checkSubscription($response->creator);
$checkPayPerView = auth()->user()->payPerView()->where('updates_id', $response->id)->first();
}
$creatorLive = Helper::isCreatorLive($getCurrentLiveCreators , $response->creator->id);
$totalLikes = number_format($response->likes->count());
$totalComments = $response->totalComments();
$mediaCount = $response->media->count();
$allFiles = $response->media()->groupBy('type')->get();
$getFirstFile = $response->media()->whereIn('type', ['image', 'video'])->where('video_embed', '')->first();
$mediaImageVideo = $response->media()
->whereIn('type', ['image', 'video'])
->where('video_embed', '')
->get();
if ($getFirstFile && $getFirstFile->type == 'image') {
$urlMedia = url('media/storage/focus/photo', $getFirstFile->id);
$backgroundPostLocked = 'background: url('.$urlMedia.') no-repeat center center #b9b9b9; background-size: cover;';
$textWhite = 'text-white';
} elseif ($getFirstFile && $getFirstFile->type == 'video' && $getFirstFile->video_poster) {
$videoPoster = url('media/storage/focus/video', $getFirstFile->video_poster);
$backgroundPostLocked = 'background: url('.$videoPoster.') no-repeat center center #b9b9b9; background-size: cover;';
$textWhite = 'text-white';
} else {
$backgroundPostLocked = null;
$textWhite = null;
}
$countFilesImage = $response->media->where('type', 'image')->count();
$countFilesVideo = $response->media->whereIn('type', ['video', 'video_embed'])->count();
$countFilesAudio = $response->media->where('type', 'music')->count();
$mediaImageVideoTotal = $response->media->whereIn('type', ['image', 'video'])->count();
$isVideoEmbed = $response->media[0]->video_embed ?? false;
$nth = 0; // nth foreach nth-child(3n-1)
@endphp
{{ __('general.pinned_post') }}
@if ($response->status == 'pending')
{{ __('general.post_pending_review') }}
@endif
@if ($response->status == 'schedule')
{{ __('general.date_schedule') }} {{ Helper::formatDateSchedule($response->scheduled_date) }}
@endif
@if (auth()->check() && auth()->user()->id == $response->creator->id
|| $response->locked == 'yes' && $mediaCount != 0
|| auth()->check() && $response->locked == 'yes'
&& $checkUserSubscription
&& $response->price == 0.00
|| auth()->check() && $response->locked == 'yes'
&& $checkUserSubscription
&& $response->price != 0.00
&& $checkPayPerView
|| auth()->check() && $response->locked == 'yes'
&& $response->price != 0.00
&& ! $checkUserSubscription
&& $checkPayPerView
|| auth()->check() && auth()->user()->role == 'admin' && auth()->user()->permission == 'all'
|| $response->locked == 'no'
)
{!! Helper::linkText(Helper::checkText($response->description, $isVideoEmbed ?? null)) !!}
{{ __('general.view_all') }}
@else
@if ($response->title)
{!! Helper::linkText($response->title) !!}
@endif
@endif
@if (auth()->check() && auth()->user()->id == $response->creator->id
|| auth()->check() && $response->locked == 'yes'
&& $checkUserSubscription
&& $response->price == 0.00
|| auth()->check() && $response->locked == 'yes'
&& $checkUserSubscription
&& $response->price != 0.00
&& $checkPayPerView
|| auth()->check() && $response->locked == 'yes'
&& $response->price != 0.00
&& ! $checkUserSubscription
&& $checkPayPerView
|| auth()->check() && auth()->user()->role == 'admin' && auth()->user()->permission == 'all'
|| $response->locked == 'no'
)
@if ($mediaImageVideoTotal <> 0)
@include('includes.media-post')
@endif
@foreach ($response->media as $media)
@if ($media->music != '')
@endif
@if ($media->type == 'file')
{{ $media->file_name }}.zip
{{ $media->file_size }}
@endif
@if ($media->type == 'epub')
{{ $media->file_name }}.epub
{{ __('general.view_online') }}
@endif
@endforeach
@if ($isVideoEmbed)
@if (in_array(Helper::videoUrl($isVideoEmbed), array('youtube.com','www.youtube.com','youtu.be','www.youtu.be', 'm.youtube.com')))
@endif
@if (in_array(Helper::videoUrl($isVideoEmbed), array('vimeo.com','player.vimeo.com')))
@endif
@endif
@else
@if ($response->creator->planActive() && $response->price == 0.00
|| $response->creator->free_subscription == 'yes' && $response->price == 0.00)
route()->named('profile')) @if ($response->creator->free_subscription == 'yes') data-toggle="modal" data-target="#subscriptionFreeForm" @else data-toggle="modal" data-target="#subscriptionForm" @endif @endif @endguest class="btn btn-primary w-100">
{{ __('general.content_locked_user_logged') }}
@elseif ($response->creator->planActive() && $response->price != 0.00
|| $response->creator->free_subscription == 'yes' && $response->price != 0.00)
status == 'active') data-toggle="modal" data-target="#payPerViewForm" data-mediaid="{{$response->id}}" data-price="{{Helper::formatPrice($response->price, true)}}" data-subtotalprice="{{Helper::formatPrice($response->price)}}" data-pricegross="{{$response->price}}" @endif @endguest class="btn btn-primary w-100">
@guest
{{ __('general.content_locked_user_logged') }}
@else
@if ($response->status == 'active')
{{ __('general.unlock_post_for') }} {{Helper::formatPrice($response->price)}}
@else
{{ __('general.post_pending_review') }}
@endif
@endguest
@else
{{ __('general.subscription_not_available') }}
@endif
@if ($mediaCount == 0)
- {{ __('admin.text') }}
@endif
@if ($mediaCount != 0)
@foreach ($allFiles as $media)
@if ($media->type == 'image')
- {{$countFilesImage}}
@endif
@if ($media->type == 'video')
- {{$countFilesVideo}} @if ($media->duration_video && $countFilesVideo == 1 || $media->quality_video && $countFilesVideo == 1) @if ($media->quality_video){{ $media->quality_video }}@endif {{ $media->duration_video }} @endif
@endif
@if ($media->type == 'music')
- {{$countFilesAudio}}
@endif
@if ($media->type == 'file')
- {{$media->file_size}}
@endif
@if ($media->type == 'epub')
- {{$media->file_size}}
@endif
@endforeach
@endif
@endif
@if ($response->status == 'active')
@endif
@if (request()->is('/') && $loop->first && $users->count() != 0
|| request()->is('explore') && $loop->first && $users->count() != 0
|| request()->is('my/bookmarks') && $loop->first && $users->count() != 0
|| request()->is('my/purchases') && $loop->first && $users->count() != 0
|| request()->is('my/likes') && $loop->first && $users->count() != 0
)