@extends('admin.layout') @section('title', 'Category') @section('header') @endsection @section('content')
| SN | CATEGORY NAME | CATEGORY NAME IN TAMIL | PREVIEW | CREATED DATE | ACTION |
|---|---|---|---|---|---|
| {{ $loop->iteration }} | {{ $category->category_name }} | {{ $category->cat_name }} | {{-- Category Image --}}
@php
$imageUrl = null;
$digitalOceanBaseUrl =
'https://dstone.sfo3.digitaloceanspaces.com';
if (
!empty(
$category->category_image
)
) {
$storedImage = ltrim(
trim(
$category->category_image
),
'/'
);
/*
|--------------------------------------------------------------------------
| Already full URL
|--------------------------------------------------------------------------
*/
if (
str_starts_with(
$storedImage,
'http://'
) ||
str_starts_with(
$storedImage,
'https://'
)
) {
$imageUrl =
$storedImage;
/*
|--------------------------------------------------------------------------
| New DigitalOcean path
|--------------------------------------------------------------------------
| DB: icons/1784800073_images.jpg
|--------------------------------------------------------------------------
*/
} elseif (
str_starts_with(
$storedImage,
'icons/'
)
) {
$imageUrl =
rtrim(
$digitalOceanBaseUrl,
'/'
) .
'/' .
$storedImage;
/*
|--------------------------------------------------------------------------
| Old local path
|--------------------------------------------------------------------------
| DB: assets/uploads/icons/image.png
|--------------------------------------------------------------------------
*/
} else {
$imageUrl = asset(
$storedImage
);
}
}
@endphp
@if($imageUrl)
|
{{ $category->created_at->format('Y-m-d') }} |