@php
// detect if controller provided a paginator (server-side pagination)
$serverPaginated = (isset($songs) && is_object($songs) && method_exists($songs, 'links')) ? true : false;
// If the parent view provided a paginator ($songs) rather than a prepared $songsList,
// build $songsList here so the component logic can remain unchanged.
if((!isset($songsList) || !is_array($songsList) || count($songsList) == 0) && isset($songs) && count($songs) > 0){
$songsList = [];
$idx = 1;
foreach($songs as $sng){
$artist_id = json_decode($sng->artist_id);
$artist_array = [];
if(is_array($artist_id)){
foreach($artist_id as $artist){
$art = Modules\Artist\Entities\Artist::select('artist_name')->where('id',$artist)->first();
if($art){ $artist_array[] = $art->artist_name; }
}
}
$artist_name = implode(',',$artist_array);
$songsList[] = [
'songs' => $sng,
'artist_name' => $artist_name,
'id' => $idx
];
$idx++;
}
}
$enableGuest = false;
foreach($songsList as $song):
if($song['songs']->guest_id != null){
$enableGuest = true;
}
endforeach
@endphp
- Date
- Recently Added
- Behind the Mic
@if($enableGuest)
- Guest
@endif
- Duration
- More
@if(count($songs) > 0)
@php $i = 1; @endphp
@foreach($songsList as $song)
@php
$artist_name = $song['artist_name'];
$programPlaylist[] =audioPath($song['songs']);
$guestDetails = $song['songs']->guest_id;
if($guestDetails!=null){
$guestDetails = json_decode($guestDetails,true);
}
$guest_name = "";
if(is_array($guestDetails) && count($guestDetails) > 0){
$guest_list = Modules\Artist\Entities\Artist::select('artist_name')->whereIn('id',$guestDetails)->get();
foreach ($guest_list as $key => $value) {
$guest_name .= ", ".$value->artist_name;
}
$guest_name = ltrim($guest_name,",");
}
@endphp
@php
// expose raw date and duration data attributes for client-side sort/filter
$created_ts = strtotime($song['songs']->created_at);
$duration_text = $song['songs']->audio_duration ?? '';
@endphp
25) style="display:none" @endif>
-
{{-- {{ date('d M Y',strtotime($song['songs']->created_at)) }} --}}
@php
$time = strtotime($song['songs']->created_at);
$time = $time - (10*60);
$time = date('d M Y',$time);
@endphp
{{ $time }}
- {{ $song['songs']->audio_title ?? "" }}
{{-- --}}
-
{{ $artist_name ?? "" }}
@if($enableGuest)
-
{{ $guest_name ?? "" }}
@endif
- {{ $song['songs']->audio_duration }}
@php
// $sharePath = $sharePath;
@endphp
-
@php
$i++;
@endphp
@endforeach
@if($serverPaginated)
@else
{{ count($songsList) }}
@endif
@else
No songs found.
@endif