@php
$resources = DB::table('resources')
->where('category', $category->id)
->orderBy('id', 'desc')
->paginate(10, ['*'], 'page_' . $category->id);
@endphp
@if($resources->count() > 0)
| # |
Filename |
Size |
Action |
@foreach ($resources as $resource)
@php
$filePath = public_path('uploads/resources/' . $resource->file);
$fileExists = file_exists($filePath);
$fileSize = $fileExists ? formatBytes(filesize($filePath)) : 'File not found';
@endphp
| {{ $resource->id }} |
{{ $resource->filename }}
|
{{ $fileSize }}
|
@if($fileExists)
Download
@else
Not Available
@endif
|
@endforeach
@else
No resources available in this category yet.
@endif