Closed meetwithchuks closed 7 months ago
My bad. I was supposed to add relation
attribute to thex-splade-select
.
<x-splade-select name="vehicle_type" :options="$vehicle_types" label="{{ __('Vehicle Type') }}" relation choices />
<x-app-layout>
<x-slot:header>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
{{ __('Edit Courier') }}
</h2>
</x-slot>
<div class="py-10">
<div class="max-w-full mx-auto sm:px-6 lg:px-8">
<div class="min-h-screen bg-white overflow-hidden shadow-xl sm:rounded-lg p-10">
<x-splade-modal>
<div class="mx-auto p-5">
<x-splade-form :default="$courier" class=" space-y-5" method="PATCH" action="{{ 'courier.update',$courier) }}" >
<h3 class="text-primary heading-3">{{ __('Edit Courier') }}</h3>
<div class="flex gap-10">
<div class="col-span-3 space-y-5">
<x-splade-input name="firstname" label="{{ __('Firstname') }}" required />
<x-splade-input name="lastname" label="{{ __('Lastname') }}" required />
<x-splade-input type="email" name="email" label="{{ __('Email') }}" required />
<x-splade-input type="phone" name="phone" label="{{ __('Phone') }}" required />
<x-splade-select name="vehicle_type" :options="$vehicle_types" label="{{ __('Vehicle Type') }}" relation choices />
<x-splade-textarea name="message" label="{{ __('Message') }}" autosize />
</div>
</div>
<div class="flex gap-5 justify-start items-center">
<x-splade-submit label="{{ __('Save') }}" />
<x-custom.link-outline2 class="border-red-200" url="{{ 'courier.index') }}">{{ __('Cancel') }}</x-custom.link-outline2>
<p v-if="form.processing">Updating the data...</p>
<p v-if="form.wasSuccessful" class="text-green-700">Successfully Updated!</p>
</div>
</x-splade-form>
</div>
</x-splade-modal>
</div>
</div>
</div>
</x-app-layout>
Laravel Version: 10.20.0 PHP Version: 8.2.12 Splade JS Version (npm): 1.4.16 Splade PHP Version (composer): 1.4.16
Description:
Blade form is not fetching/selecting the default value.
Steps To Reproduce Issue:
CourierController
Blade: