@extends('layouts.app') @php($canManage = !auth()->user()->isStudent()) @section('title', 'Learning Library') @section('subtitle', 'Notes, videos and study resources') @section('content') @if ($canManage) Add resource @endif
@forelse ($materials as $material)
{{ $types[$material->type] ?? ucfirst($material->type) }} @unless ($material->is_published) Draft @endunless

{{ $material->title }}

{{ $material->course?->name ?? 'All students' }} @if ($material->duration_minutes) ยท {{ $material->duration_minutes }} min @endif

{{ \Illuminate\Support\Str::limit($material->description, 110) ?: 'No description.' }}

@php($link = $material->file_path ? route('materials.download', $material) : $material->url) @if ($link) {{ $material->file_path ? 'Download' : 'Open' }} @else No file @endif @if ($canManage) @if (auth()->user()->isAdminOrStaff())
@csrf @method('DELETE')
@endif @endif
Added {{ $material->created_at->diffForHumans() }}@if ($material->uploader) by {{ $material->uploader->name }}@endif
@empty
@endforelse
@if ($materials->hasPages())
{{ $materials->links() }}
@endif @endsection