@extends('admin.layout') @section('content')
| S/N | TITLE | DESCRIPTION | IMAGE | CREATED DATE | ACTION |
|---|---|---|---|---|---|
| {{ $loop->iteration }} | {{ $notifi->title }} | {{ $notifi->description }} |
@php
$notificationImageUrl = null;
$digitalOceanBaseUrl =
'https://dstone.sfo3.digitaloceanspaces.com';
if (!empty($notifi->image)) {
$storedImage = ltrim(
trim($notifi->image),
'/'
);
/*
|--------------------------------------------------------------------------
| Already full URL
|--------------------------------------------------------------------------
*/
if (
str_starts_with(
$storedImage,
'http://'
) ||
str_starts_with(
$storedImage,
'https://'
)
) {
$notificationImageUrl =
$storedImage;
/*
|--------------------------------------------------------------------------
| DigitalOcean paths
|--------------------------------------------------------------------------
*/
} elseif (
str_starts_with(
$storedImage,
'advertisement/'
) ||
str_starts_with(
$storedImage,
'icons/'
)
) {
/*
|--------------------------------------------------------------------------
| Encode spaces and special characters in filename
|--------------------------------------------------------------------------
*/
$encodedPath = collect(
explode('/', $storedImage)
)->map(
fn ($part) => rawurlencode($part)
)->implode('/');
$notificationImageUrl =
rtrim(
$digitalOceanBaseUrl,
'/'
) .
'/' .
$encodedPath;
/*
|--------------------------------------------------------------------------
| Old local path
|--------------------------------------------------------------------------
*/
} else {
$notificationImageUrl =
asset($storedImage);
}
}
@endphp
@if($notificationImageUrl)
|
{{ $notifi->created_at->format('Y-m-d') }} |