@php($i = 0)
@if(!$contents->isEmpty())
@foreach($contents as $content)
@php($screen_ids = $content->getContentScreens->pluck('screen_id')->toArray())
@php($viewers = DB::table('screens')->whereIn('id', $screen_ids)->sum('viewer'))
@php($media_ids = $content->contentMedias->pluck('media_id')->toArray())
@php($medias = DB::table('media')->whereIn('id', $media_ids)->pluck('path')->toArray())
@if($content->start_date > date('Y-m-d'))
@php($status = 'Future')
@elseif($content->end_date < date('Y-m-d'))
@php($status = 'Past')
@elseif($content->start_date >= date('Y-m-d') || $content->start_date <= date('Y-m-d'))
@php($status = 'Current')
@endif
@php($total_slot = 0)
@php($slot_count = 0)
@foreach ($medias as $key => $media)
@php($info = new \SplFileInfo($media))
@php($ext = $info->getExtension())
@php($video_ext = Config('global.video_extensions'))
@php($image_ext = Config('global.image_extensions'))
@if(in_array($ext,$video_ext))
@php($getID3 = new \getID3)
@php($file = $getID3->analyze(public_path('uploads/items/video/'.$media)))
@php($duration = seconds_from_time(date('H:i:s', $file['playtime_seconds'])))
@php($duration_actual = (date('H:i:s', $file['playtime_seconds'])))
@php($_slot_count = $duration/15)
@php($slot_count += ceil($_slot_count))
@elseif(in_array($ext,$image_ext))
@php($slot_count += 1)
@endif
@endforeach
@php($total_slot += $slot_count)
{{-- @if($status == 'Current') --}}
Locations |
{{ !empty($content->getContentScreens) ? count($content->getContentScreens) : 0 }} |
Start date |
{{ date('M d - Y', strtotime($content->start_date)) }} |
End date |
{{ date('M d - Y', strtotime($content->end_date)) }} |
Cost (SAR) |
{{ number_format($content->price, 0) }} |
Content |
{{ !empty($content->contentMedias) ? count($content->contentMedias) : 0 }} |
Slot |
{{ $total_slot }} |
Viewership |
{{ !empty($viewers) ? thousandsCurrencyFormat($viewers) : 0 }} |
@php($i++)
{{-- @endif --}}
@endforeach
@else
@endif