@extends('admin.layout') @section('title', 'youtube screen') @section('content')
Create News

@csrf
@error('notification_title')
{{ $message }}
@enderror
@error('description')
{{ $message }}
@enderror
Click to Upload
( Max file size: 5 MB, JPG only )
@error('image')
{{ $message }}
@enderror
@error('one')
{{ $message }}
@enderror
History
@php $sn = 1; // Initialize serial number @endphp @foreach ($advertisement as $advertise) @endforeach
S/N Title Description PREVIEW URL CREATED ON Action
{{ $loop->iteration }} {{ $advertise->title }} {{ $advertise->description }} @php $advertiseImageUrl = null; $digitalOceanBaseUrl = 'https://dstone.sfo3.digitaloceanspaces.com'; if (!empty($advertise->image)) { $storedImage = ltrim( trim($advertise->image), '/' ); /* |-------------------------------------------------------------------------- | Already full URL |-------------------------------------------------------------------------- */ if ( str_starts_with( $storedImage, 'http://' ) || str_starts_with( $storedImage, 'https://' ) ) { $advertiseImageUrl = $storedImage; /* |-------------------------------------------------------------------------- | DigitalOcean paths |-------------------------------------------------------------------------- */ } elseif ( str_starts_with( $storedImage, 'advertisement/' ) || str_starts_with( $storedImage, 'icons/' ) ) { /* |-------------------------------------------------------------------------- | Encode spaces and special characters |-------------------------------------------------------------------------- */ $encodedPath = collect( explode('/', $storedImage) )->map( fn ($part) => rawurlencode($part) )->implode('/'); $advertiseImageUrl = rtrim( $digitalOceanBaseUrl, '/' ) . '/' . $encodedPath; /* |-------------------------------------------------------------------------- | Old local path |-------------------------------------------------------------------------- */ } else { $advertiseImageUrl = asset($storedImage); } } @endphp @if($advertiseImageUrl) Advertisement image @else Null @endif {{ $advertise->one ?? 'N/A'}} {{ $advertise->created_at ->format('Y-m-d') }}
@endsection @section('footer') @endsection