@extends('admin.layout') @section('title', 'Category') @section('header') @endsection @section('content')

Create Category

@csrf
@if ($errors->has('category_name')) {{ $errors->first('category_name') }} @endif

Click to Upload

( Max file size: 1 MB, PNG Only )
@php $sn = 1; @endphp @foreach ($category_list as $category) {{-- Category Image --}} @endforeach
SN CATEGORY NAME CATEGORY NAME IN TAMIL PREVIEW CREATED DATE ACTION
{{ $loop->iteration }} {{ $category->category_name }} {{ $category->cat_name }} @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->category_name ?? 'Category image' }} @else No image @endif {{ $category->created_at->format('Y-m-d') }}
@endsection @section('footer') @endsection