@props([ 'course', 'compact' => false, ]) @php $title = (string) ($course->title ?? 'Untitled course'); $slugTitle = \Illuminate\Support\Str::lower($title); $track = 'Professional Skill'; if (\Illuminate\Support\Str::contains($slugTitle, ['graphic', 'design'])) { $track = 'Graphic & Multimedia'; } elseif (\Illuminate\Support\Str::contains($slugTitle, ['marketing', 'seo', 'digital'])) { $track = 'Digital Marketing'; } elseif (\Illuminate\Support\Str::contains($slugTitle, ['hardware', 'network'])) { $track = 'Hardware & Networking'; } elseif (\Illuminate\Support\Str::contains($slugTitle, ['web', '.net', 'dotnet', 'software', 'development'])) { $track = 'Web & Software'; } $thumbnailUrl = $course->thumbnail_url ?? null; $plainDescription = trim(strip_tags(html_entity_decode((string) ($course->description ?? ''), ENT_QUOTES | ENT_HTML5, 'UTF-8'))); $description = \Illuminate\Support\Str::limit(preg_replace('/\s+/u', ' ', $plainDescription) ?: 'Build practical skills through mentor-led classes, projects, and review support.', $compact ? 90 : 130); $onlinePrice = $course->online_discount_price ?: $course->discount_price; $offlinePrice = $course->offline_discount_price ?: $course->discount_price; $lowestPrice = collect([$onlinePrice, $offlinePrice, $course->discount_price])->filter(fn ($value) => $value !== null && (float) $value > 0)->map(fn ($value) => (float) $value)->min(); $batches = $course->relationLoaded('batches') ? $course->batches : collect(); $activeBatches = $batches ->filter(fn ($batch) => in_array($batch->status, ['upcoming', 'running'], true)) ->sortBy('start_date') ->values(); $nextBatch = $activeBatches->first(); $batchRotationPayload = $activeBatches->map(fn ($batch) => [ 'start_date' => optional($batch->start_date)->format('d M Y') ?: 'Announced soon', 'class_time' => $batch->class_time ?: 'Contact office', ])->all(); @endphp
merge(['class' => 'group overflow-hidden rounded-[1.75rem] border border-slate-200 bg-white shadow-sm transition duration-300 hover:-translate-y-1 hover:border-[#f15a24]/40 hover:shadow-xl hover:shadow-[#292b86]/10']) }}>
@if($thumbnailUrl) {{ $title }}
@else
{{ $title }}
@endif
{{ $track }}
@if($lowestPrice)
৳{{ number_format($lowestPrice, 0) }}
@endif

{{ $description }}

@if($nextBatch)
Next batch {{ optional($nextBatch->start_date)->format('d M Y') ?: 'Announced soon' }}
Class time {{ $nextBatch->class_time ?: 'Contact office' }}
@else
Batch update Contact office for the next schedule.
@endif
View details @auth Enroll @else @endauth