@extends('admin::layouts.master') @section('title', 'Media Library') @php $mediaTypes = ['image' => ['bg' => 'blue', 'icon' => 'M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z'], 'video' => ['bg' => 'purple', 'icon' => 'M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664zM21 12a9 9 0 11-18 0 9 9 0 0118 0z'], 'file' => ['bg' => 'gray', 'icon' => 'M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z']]; $filterParams = array_filter(['mediable_type' => request('mediable_type'), 'mediable_id' => request('mediable_id')]); @endphp @section('content')

Media Library

@if($mediableType && $mediableId) {{ class_basename($mediableType) }} #{{ $mediableId }} × @endif
Upload File

{{ $stats['images'] }}

Images

{{ $stats['videos'] }}

Videos

{{ $stats['files'] }}

Files

{{ $stats['total'] }}

Total

{{ $mediaList->count() }} file(s)
@if($mediaList->isEmpty())

No media files found

Upload your first file to get started.

Upload File
@elseif($viewMode === 'list')
@foreach($mediaList as $media) @php $url = Storage::disk('public')->url($media->path); @endphp @endforeach
Name Type Size Attached To Uploaded Actions
@if($media->type === 'image')
@elseif($media->type === 'video')
@else
@endif

{{ $media->filename }}

{{ $media->mime_type ?? ucfirst($media->type) }}

{{ $media->type }} {{ number_format($media->size / 1024, 1) }} KB {{ class_basename($media->mediable_type) }} #{{ $media->mediable_id }} {{ $media->created_at->format('d M Y') }}
@if($media->type === 'image') @endif
@csrf @method('DELETE')
@else
@foreach($mediaList as $media) @php $url = Storage::disk('public')->url($media->path); @endphp
@if($media->type === 'image') {{ $media->filename }} @elseif($media->type === 'video')
@else
@endif
@if($media->type === 'image') @endif
{{ $media->type }}

{{ $media->filename }}

{{ number_format($media->size / 1024, 1) }} KB

{{ $media->created_at->format('d M Y') }}

{{ class_basename($media->mediable_type) }} #{{ $media->mediable_id }}
@csrf @method('DELETE')
@endforeach
@endif
@endsection