@extends('admin.layout') @section('content')
Create Notification

@csrf
@error('notification_title')
{{ $message }}
@enderror
@error('description')
{{ $message }}
@enderror
Notifications
@php $sn = 1; // Initialize serial number @endphp @foreach ($notification as $notifi) @endforeach
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) Notification image @else Null @endif {{ $notifi->created_at->format('Y-m-d') }}
@endsection