@php use App\Models\Vehicle; /** @var Vehicle $vehicle */ @endphp {{ Breadcrumbs::render('vehicles') }}

{{ __('Vehicles') }}

@php $fields = explode(',', env('FIELDS', '')); $headerValues = [ 'image' => ['type' => 'string', 'value' => __('Photo'),], 'id' => ['type' => 'string', 'value' => __('Id')], 'name' => ['type' => 'string', 'value' => __('Name')], 'brand' => ['type' => 'string', 'value' => __('Brand')], 'class' => ['type' => 'string', 'value' => __('Class')], 'storage' => ['type' => 'string', 'value' => __('Storage')], 'fuel_type' => ['type' => 'string', 'value' => __('Fuel Type')], 'fuel_volume' => ['type' => 'string', 'value' => __('Fuel Volume')], 'seats' => ['type' => 'string', 'value' => __('Seats')], 'top_speed' => ['type' => 'string', 'value' => __('Top Speed')], 'price' => ['type' => 'string', 'value' => __('Price')], 'vendor' => ['type' => 'string', 'value' => __('Vendor')], ]; $values = []; foreach ($fields as $field) { $values[0][$field] = $headerValues[$field]; } $index = 0; foreach ($vehicles as $key => $vehicle) { $index++; $fieldValues = [ 'image' => ['type' => 'image', 'value' => asset('img/vehicles/' . $vehicle->getVehicleId() . '.png')], 'id' => ['type' => 'int', 'value' => $vehicle->getVehicleId()], 'name' => ['type' => 'string', 'value' => $vehicle->getVehicleName()], 'brand' => ['type' => 'string', 'value' => $brands->firstWhere('brand_id', '=', $vehicle->getBrandId())->getBrandName()], 'class' => ['type' => 'string', 'value' => $vehicleClasses->firstWhere('vehicle_class_id', '=', $vehicle->getVehicleClassId())->getVehicleClassName()], 'storage' => ['type' => 'int', 'value' => $vehicle->getVehicleStorage()], 'fuel_type' => ['type' => 'string', 'value' => $fuelTypes->firstWhere('fuel_type_id', '=', $vehicle->getFuelTypeId())->getFuelTypeName()], 'fuel_volume' => ['type' => 'int', 'value' => $vehicle->getVehicleFuelVolume(), 'unit' => env('FUEL_VOLUME_UNIT', 'l')], 'seats' => ['type' => 'int', 'value' => $vehicle->getVehicleSeats()], 'top_speed' => ['type' => 'int', 'value' => $vehicle->getVehicleTopSpeed(), 'unit' => env('SPEED_UNIT', 'km/h')], 'price' => ['type' => 'int', 'value' => $vehicle->getVehiclePrice(), 'unit' => env('CURRENCY', '$')], 'vendor' => ['type' => 'string', 'value' => $vendors->firstWhere('vendor_id', '=', $vehicle->getVendorId())->getVendorName()], ]; foreach ($fields as $field) { $values[$index][$field] = $fieldValues[$field]; } } @endphp @switch(app('request')->input('listMode') ?? env('DEFAULT_DISPLAY_MODE')) @case('tableHorizontal') @case('tableVertical') @break @default @foreach($vehicles as $key => $vehicle) @endforeach @endswitch {{ $vehicles->links() }}