Manage

Courses

New course
@php $isAdmin = Auth::user()->isAdmin(); $live = $courses->where('published', true)->count(); $drafts = $courses->count() - $live; $enrolled = $courses->sum('students_count'); $completed = $courses->sum('completed_count'); $figures = [ ['Active', $live], ['Inactive', $drafts], ['Enrolments', number_format($enrolled)], ['Completion rate', $enrolled ? round($completed / $enrolled * 100).'%' : '—'], ]; $filters = ['all' => ['All', $courses->count()], 'live' => ['Active', $live], 'draft' => ['Inactive', $drafts]]; // Search text + state per tile, read by Alpine in the same order as the grid $rows = $courses->map(fn ($c) => [ 'text' => Str::lower($c->title.' '.$c->department.' '.($isAdmin ? $c->instructor->name : '')), 'state' => $c->published ? 'live' : 'draft', ])->values(); @endphp

{{ $courses->count() }} {{ Str::plural('course', $courses->count()) }} in your library.

{{ number_format($completed) }} of {{ number_format($enrolled) }} {{ Str::plural('enrolment', $enrolled) }} completed so far.

@foreach ($figures as $i => [$label, $value])
$i > 0, 'pl-6 border-l border-white/10 lg:pl-8' => $i % 2 === 1])>
{{ $value }}
{{ $label }}
@endforeach
@if ($courses->isEmpty())

No courses yet

Create a course, add modules and lessons, then publish it to the catalogue.

Create your first course
@else
{{-- Filters --}}
@foreach ($filters as $key => [$label, $count]) @endforeach
{{-- Course tiles --}}
@foreach ($courses as $course) @php $dots = min($course->lessons_count, 12); $rate = $course->students_count ? round($course->completed_count / $course->students_count * 100) : 0; // Department hue glows behind the globe so tiles scan by department $glow = ['Finance' => '20 184 166', 'Human Resources' => '217 119 6', 'IT' => '56 189 248', 'Operations' => '167 139 250', 'Sales' => '244 114 182'][$course->department] ?? '148 163 184'; @endphp
@if ($course->coverUrl())
@endif
{{ $course->department ?? 'All staff' }} @if ($course->published) Active @else Inactive @endif
@if ($dots) @endif
{{-- Whole tile opens the editor --}}

{{ $course->title }}

{{ $course->modules_count }} {{ Str::plural('module', $course->modules_count) }}, {{ $course->lessons_count }} {{ Str::plural('lesson', $course->lessons_count) }} @if ($isAdmin) by {{ $course->instructor->name }} @endif

{{ $course->students_count }} enrolled {{ $course->students_count ? $course->completed_count.' completed' : 'No learners yet' }}
@endforeach

No courses match these filters.

@endif