@extends('admin.layout') @section('title', 'youtube screen') @section('content')
| 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)
|
{{ $advertise->one ?? 'N/A'}} | {{ $advertise->created_at ->format('Y-m-d') }} |