@extends('layouts.app') @section('title', 'Materials Management') @section('page-title', 'Materials Management') @section('header-buttons') @auth @if(auth()->user()->teacher) Upload Material @endif @endauth @endsection @section('content') @auth @if(auth()->user()->teacher) @php // Calculate statistics $myMaterialsCount = \App\Models\Material::where('uploaded_by_teacher_id', auth()->user()->teacher->id)->count(); $publishedCount = \App\Models\Material::where('uploaded_by_teacher_id', auth()->user()->teacher->id)->where('published', true)->count(); $unpublishedCount = $myMaterialsCount - $publishedCount; $totalFileSize = \App\Models\Material::where('uploaded_by_teacher_id', auth()->user()->teacher->id)->sum('file_size'); function formatBytes($bytes, $precision = 2) { $units = ['B', 'KB', 'MB', 'GB', 'TB']; $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . ' ' . $units[$pow]; } @endphp
Total Materials
Published
Unpublished
Storage Used
Start sharing study materials with your students by uploading your first file.
Upload Your First Material| Material Title | Class Details | Uploaded By | File Information | Status | Upload Date | Actions |
|---|---|---|---|---|---|---|
|
{{ Str::limit($material->title, 50) }}
@auth
@if(auth()->user()->teacher && $material->uploaded_by_teacher_id == auth()->user()->teacher->id)
My Upload
@endif
@endauth
|
Batch: {{ $material->class->batch->name }}
Subject: {{ $material->class->subject->title }}
|
{{ $material->teacher->user->username }}
Teacher
|
{{ $material->file_extension }}
{{ $material->file_size_formatted }}
|
{{ $material->published ? 'Published' : 'Draft' }} | {{ $material->created_at->format('M d, Y') }} | |
No materials found@if(request()->hasAny(['class_id', 'published', 'search']))Try adjusting your filters or search terms Clear Filters @elseif(auth()->user()->teacher)Ready to upload your first study material? Upload Material @endif |
||||||