@extends('layouts.master') @section('title') @lang('Title') @endsection @section('css') @endsection @section('content')

Product

Product
@if ($message = Session::has('success'))
{{ $message }}
@endif
@method('PUT') {{ csrf_field() }} @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
@if ($errors->has('title'))
{{ $errors->first('title') }}
@endif
@if ($errors->has('summary'))
{{ $errors->first('summary') }}
@endif
@if ($errors->has('description'))
{{ $errors->first('description') }}
@endif
is_featured==1)? 'checked' : '')}} > Yes
@if ($errors->has('cat_id'))
{{ $errors->first('cat_id') }}
@endif
@if ($errors->has('price'))
{{ $errors->first('price') }}
@endif
@if ($errors->has('discount'))
{{ $errors->first('discount') }}
@endif
@if ($errors->has('stock'))
{{ $errors->first('stock') }}
@endif
@if ($errors->has('status'))
{{ $errors->first('status') }}
@endif
@php $productTypes = getProductTypes(); @endphp
@if ($errors->has('product_type'))
{{ $errors->first('product_type') }}
@endif
@if(!empty($product->filename)) @if(in_array(pathinfo($product->filename, PATHINFO_EXTENSION), ['jpg', 'jpeg', 'png', 'gif'])) filename")}}" alt="Example Image" style="max-width: 25%; height: auto;"> @else filename")}}" download>Download {{ basename($product->filename) }} @endif @endif @if ($errors->has('file'))
{{ $errors->first('file') }}
@endif
@php // $file_array=array(); $fileData = []; // Initialize as an array before appending foreach($product->galleries as $gallery){ // $file_array[]=$gallery->filename; if (Storage::disk('public')->exists('uploads/product/' . $gallery->filename)) { $fileData[] = [ 'file_name' => $gallery->filename, 'file_size' => Storage::disk('public')->size('uploads/product/' . $gallery->filename), 'file_url' => asset('storage/uploads/product/' . $gallery->filename) ]; } else { // Handle missing file case Log::error('File not found: ' . $gallery->filename); } } // $fileName = json_encode($file_array); @endphp
@endsection @section('script') @endsection