@extends('admin.layouts.app') @section('title', admin_trans('media_library')) @section('page-title', admin_trans('media_library')) @section('content')

{{ admin_trans('drag_files_or_click') }}

{{ admin_trans('upload_limit_text') }}

{{ admin_trans('uploading') }}...
{{ admin_trans('upload_files') }}
@foreach (request()->except(['search', 'page']) as $key => $value) @endforeach
@if (request('search')) @else @endif
@if (request('search')) @endif
@if ($collections->count() > 0)
@endif
@if (request()->hasAny(['search', 'file_type', 'collection', 'sort', 'model_type'])) {{ admin_trans('clear_filters') }} @endif {{ admin_trans('update') }}
@if (request()->hasAny(['search', 'file_type', 'collection', 'sort', 'model_type']))
{{ admin_trans('active_filters') }}: @if (request('search')) "{{ request('search') }}" @endif @if (request('file_type')) {{ request('file_type') === 'image' ? admin_trans('images') : (request('file_type') === 'video' ? admin_trans('videos') : admin_trans('documents')) }} @endif @if (request('collection')) {{ ucfirst(request('collection')) }} @endif @if (request('model_type')) {{ $availableModels[request('model_type')] ?? request('model_type') }} @endif
@endif
{{ admin_trans('download') }} {{ admin_trans('delete') }} {{ admin_trans('clear') }}
@if ($media->isEmpty()) {{ admin_trans('upload_first_file') }} @else
@foreach ($media as $item)
@if (str_starts_with($item->mime_type, 'image/')) @php // محاولة الحصول على رابط الصورة بطرق مختلفة $url = null; $customProperties = $item->custom_properties ?? []; // الطريقة الأولى: من custom_properties if ( isset($customProperties['path']) && Storage::disk('public')->exists($customProperties['path']) ) { $url = asset('storage/' . $customProperties['path']); } // الطريقة الثانية: جرب getUrl إذا كان متاح if (!$url) { try { if (method_exists($item, 'getUrl')) { $tempUrl = $item->getUrl(); if ($tempUrl && $tempUrl !== '') { $url = $tempUrl; } } } catch (\Exception $e) { // استمر للطريقة التالية } } // الطريقة الثالثة: جرب المسارات المحتملة if (!$url) { $possiblePaths = [ "media/{$item->getTable()}/{$item->model_id}/{$item->file_name}", "media/{$item->id}/{$item->file_name}", "media/{$item->file_name}", $item->file_name, ]; foreach ($possiblePaths as $path) { if (Storage::disk('public')->exists($path)) { $url = asset('storage/' . $path); break; } } } @endphp @if ($url) {{ $item->name }} @else

{{ admin_trans('not_available') }}

@endif @elseif(str_starts_with($item->mime_type, 'video/'))
@else
@endif

{{ Str::limit($item->name, 15) }}

{{ number_format($item->size / 1024, 0) }}KB @if ($item->collection_name !== 'default') {{ Str::limit($item->collection_name, 4) }} @endif
@if ($item->model_type)
{{ class_basename($item->model_type) }} #{{ $item->model_id }}
@endif
@endforeach
@if ($media->hasPages())
@endif @endif

{{ admin_trans('media_details') }}

{{ admin_trans('loading') }}...

{{ admin_trans('filename') }}:

{{ admin_trans('file_size') }}:

{{ admin_trans('file_type') }}:

{{ admin_trans('collection') }}:

{{ admin_trans('uploaded_at') }}:

{{ admin_trans('attached_to') }}:

{{ admin_trans('download') }} {{ admin_trans('edit') }} {{ admin_trans('delete') }}

{{ admin_trans('cleanup_unused_media') }}

{{ admin_trans('unused_files_warning') }}

{{ admin_trans('check_unused_files') }}

{{ admin_trans('checking') }}...

{{ admin_trans('unused_files_found') }}

{{ admin_trans('cancel') }} {{ admin_trans('delete_unused_files') }}

{{ admin_trans('cleaning_up') }}...

{{ admin_trans('no_unused_files') }}

{{ admin_trans('close') }}
@endsection @push('scripts') @endpush