@extends('layouts.master') @section('title', 'Detalle del Curso') @section('content')

{{ $curso->nombre }}

@forelse($sesiones as $sesion)

{{-- Archivos --}}
@if($sesion->archivos->where('tipo', 'archivo')->isEmpty())

No hay archivos disponibles.

@else
    @foreach($sesion->archivos->where('tipo', 'archivo') as $archivo)
  • {{ $archivo->nombre }}
    Descargar
  • @endforeach
@endif
{{-- Videos --}}
@if($sesion->archivos->where('tipo', 'video')->isEmpty())

No hay videos disponibles.

@else
@foreach($sesion->archivos->where('tipo', 'video') as $video) @php $youtubeId = null; if (str_contains($video->ruta, 'youtube.com') || str_contains($video->ruta, 'youtu.be')) { if (str_contains($video->ruta, 'youtu.be')) { $parts = explode('/', $video->ruta); $youtubeId = end($parts); } else { parse_str(parse_url($video->ruta, PHP_URL_QUERY), $queryParams); $youtubeId = $queryParams['v'] ?? null; } } @endphp
@if($youtubeId)
@else @endif
{{ $video->nombre }}
@endforeach
@endif
@empty
No hay sesiones registradas aún.
@endforelse
@endsection