@extends('admin.master') @section('title') Latest Car @endsection @section('content')

Latest Car

{{ $latestCar->title }}
{!! Form::open(['id' => 'latestCarForm']) !!} {!! Form::hidden('id', $latestCar->id, ['id' => 'latestCarId']) !!}
{!! Form::label('title', 'Title', ['class' => 'form-label']) !!} {!! Form::text('title', $latestCar->title, [ 'class' => 'form-control form-control-sm', 'id' => 'latestCarTitle', 'required' => true, 'placeholder' => 'Enter Title', ]) !!}
{!! Form::label('car_ids', 'Select Cars', ['class' => 'form-label']) !!} Select multiple cars to display in the latest cars section
{!! Form::close() !!}
Selected Cars
@if(!empty($latestCar->car_ids)) @php $selectedCars = \App\Models\Car::whereIn('id', $latestCar->car_ids)->with(['brand', 'carModel'])->get(); @endphp @foreach($selectedCars as $car)
{{ $car->title }}

Brand: {{ $car->brand->brand_name ?? 'N/A' }}
Model: {{ $car->carModel->model_name ?? 'N/A' }}
@if($car->price) Price: ₹{{ number_format($car->price, 2) }} @endif

@endforeach @else

No cars selected yet.

@endif
@endsection @section('javascript') @endsection