@extends('admin.layouts.app') @section('panel')
@forelse($orders as $order) {{-- SAFEST QUICK FIX: Try to read "order_type" from the pivot (if your relation exposes it), otherwise show a fallback "—". This will NOT query a non-existent column and will not crash. --}} @php // If the 'products' relation exists/eager-loaded, try to read pivot->order_type (may be null). $orderType = null; try { if (method_exists($order, 'products')) { $firstProduct = $order->products->first(); $orderType = $firstProduct?->pivot->order_type ?? null; // won't crash if missing } // If in your schema order_type actually lives on orders table, uncomment the next line: // $orderType = $orderType ?? ($order->order_type ?? null); } catch (\Throwable $e) { // If relation isn't defined, just fall through to fallback below. $orderType = null; } @endphp @empty @endforelse
@lang('Full Name') @lang('Order Number') @lang('Order Date') @lang('Price') @lang('Order Type') @lang('Status') @lang('Action')
{{ $order->firstname . ' ' . $order->lastname }} #{{ $order->order_number }} {{ $order->created_at }} {{ $general->cur_sym }}{{ $order->product_price }}{{ $orderType ?: '—' }} {!! $order->statusBadge($order->status) !!} ManualOrder
{{ $emptyMessage }}
@if ($orders->hasPages()) @endif
@endsection