@if($currentView === 'dashboard')
@foreach($categoriesData as $cat)
@php
$bgImage = $cat['image'] ? asset('storage/' . $cat['image']) : 'https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?auto=format&fit=crop&q=80&w=400';
@endphp
@endforeach
@elseif($currentView === 'list')
@if($subcategories->count() > 0)
@foreach($subcategories as $sub)
@endforeach
@endif
@forelse($tutorials as $tutorial)
@php
$img = $tutorial->image ? asset('storage/' . $tutorial->image) : 'https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?auto=format&fit=crop&q=80&w=400';
@endphp
@if($tutorial->kit_price)
🛍️
Бокс
@endif
@if($tutorial->kit_price)
@endif
@if($tutorial->subcategory)
{{ $tutorial->subcategory }}
@endif
@empty
Уроки скоро появятся 🎬
@endforelse
@elseif($currentView === 'show' && $selectedTutorial)
@if($selectedTutorial->category)
{{ $selectedTutorial->category }} @if($selectedTutorial->subcategory) • {{ $selectedTutorial->subcategory }} @endif
@endif
@php
$rawUrl = trim($selectedTutorial->youtube_url);
$youtubeId = null;
if (preg_match('/(?:youtu\.be\/|youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?|live|shorts)\/|.*[?&]v=))([a-zA-Z0-9_-]{11})/i', $rawUrl, $matches)) {
$youtubeId = $matches[1];
} elseif (preg_match('/embed\/([a-zA-Z0-9_-]{11})/i', $rawUrl, $matches)) {
$youtubeId = $matches[1];
} elseif (preg_match('/^[a-zA-Z0-9_-]{11}$/', $rawUrl)) {
$youtubeId = $rawUrl;
}
@endphp
@if($youtubeId)
@else
🚨
Система не смогла распознать ссылку.
{{ $rawUrl ? $rawUrl : 'ПУСТОТА' }}
@endif
Об уроке
@php
$shareUrl = url('/tutorials?tutorialId=' . $selectedTutorial->id);
@endphp
@if($selectedTutorial->description)
{!! $selectedTutorial->description !!}
@endif
@if($selectedTutorial->materials)
{!! $selectedTutorial->materials !!}
@endif
@endif