@extends('layouts.app') @section('content')

{{ $model->title }}

{{ $model->summary }}

@php $viewerUrl = $model->embed_url; if (is_string($viewerUrl) && str_contains($viewerUrl, 'sketchfab.com') && ! str_contains($viewerUrl, '/embed')) { if (preg_match('#sketchfab\.com/models/([a-zA-Z0-9\-]+)#', $viewerUrl, $matches)) { $viewerUrl = 'https://sketchfab.com/models/' . $matches[1] . '/embed'; } elseif (preg_match('#sketchfab\.com/3d-models/[^/?#]+-([a-zA-Z0-9\-]+)#', $viewerUrl, $matches)) { $viewerUrl = 'https://sketchfab.com/models/' . $matches[1] . '/embed'; } } @endphp
@if(!empty($model->video_url)) @endif
@php $hasVideoTab = !empty($model->video_url); $hasQuizTab = ($quiz?->published_questions_count ?? 0) > 0; $sectionsCount = count(array_filter(($model->content_sections ?? []), fn ($v) => is_string($v) && trim($v) !== '')); @endphp

Metadata

{{ ucfirst($model->model_type) }} {{ $model->species }} {{ $model->programme }} @if($hasVideoTab || $hasQuizTab || $sectionsCount > 0) @if($sectionsCount > 0) {{ $sectionsCount }} {{ \Illuminate\Support\Str::plural('section', $sectionsCount) }} @endif @if($hasVideoTab) · Video @endif @if($hasQuizTab) · Quiz @endif @endif
@if(!empty($model->video_url)) @php $videoHost = parse_url($model->video_url, PHP_URL_HOST) ?? ''; $videoHost = strtolower(preg_replace('/^www\./', '', (string) $videoHost)); if ($model->is_video_direct) { $providerLabel = strtoupper(pathinfo(parse_url($model->video_url, PHP_URL_PATH) ?? '', PATHINFO_EXTENSION) ?: 'File'); $providerClass = 'video-badge-file'; } elseif (str_contains($videoHost, 'youtu')) { $providerLabel = 'YouTube'; $providerClass = 'video-badge-youtube'; } elseif (str_contains($videoHost, 'vimeo')) { $providerLabel = 'Vimeo'; $providerClass = 'video-badge-vimeo'; } elseif (str_contains($videoHost, 'media.ed.ac.uk') || str_contains($videoHost, 'kaltura.com')) { $providerLabel = 'Media Hopper'; $providerClass = 'video-badge-mediahopper'; } else { $providerLabel = 'External'; $providerClass = 'video-badge-external'; } @endphp @endif
@endsection