@extends('layouts.admin') @section('content') @php $adminMediaAssetUrl = static function ($asset) { if (! $asset?->file_path) { return null; } $path = $asset->file_path; if (str($path)->startsWith(['http://', 'https://', '/'])) { return $path; } if (str($path)->startsWith('storage/')) { return asset($path); } if (str($path)->startsWith('images/')) { return asset($path); } if (($asset->disk ?: 'public') === 'public') { return asset('storage/'.$path); } return \Illuminate\Support\Facades\Storage::disk($asset->disk)->url($path); }; @endphp

Admin Module

Media Assets

Manage media assets records from the database.

@if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
Please check the highlighted fields and try again.
@endif
@forelse ($records as $record) @empty @endforelse
Preview Title File Type File Path Status Actions
@php $mediaUrl = $adminMediaAssetUrl($record); @endphp @if ($record->file_type === 'image' && $mediaUrl) {{ $record->alt_text_en ?: $record->title_en ?: 'Media preview' }} @else @endif @php $valueEn = $record->title_en ?: '-'; $valueAs = $record->title_as ?: $valueEn; @endphp {{ str($valueEn)->limit(80) }} {{ str($record->file_type ?? '-')->limit(80) }} {{ str($record->file_path ?? '-')->limit(80) }} @php $statusEn = str($record->status ?? '-')->replace('_', ' ')->title()->toString(); $statusAs = $selectOptionLabelsAs[$record->status ?? ''] ?? $statusEn; @endphp {{ $statusEn }}
@csrf @method('DELETE')
No media assets found.
{{ $records->links() }}
@include('admin.media-assets.create-edit', ['record' => null, 'modalId' => 'createRecordModal', 'action' => route('admin.media-assets.store'), 'method' => 'POST']) @foreach ($records as $record) @include('admin.media-assets.create-edit', ['record' => $record, 'modalId' => 'editRecordModal'.$record->id, 'action' => route('admin.media-assets.update', $record->id), 'method' => 'PUT']) @endforeach @endsection