fadil
Afterstate update
i want to use aftestatte update, and then i got an error "Cannot access offset of type string on string" in $selectedId = $state['playstation_id'];
this is my full code
Select::make('playstation_id')
->label('Nama Playstation')
->relationship('playstation', 'name')
->reactive()
->afterStateUpdated(function (Closure $set, $state) {
$selectedId = $state['playstation_id'];
$selectedPlaystation = Playstation::find($selectedId);
if ($selectedPlaystation) {
$price = $selectedPlaystation->price;
} else {
$price = 0;
}
$set('price', $price);
})
hope u help me, thanks
7 replies
How to connect input form
I want to make the following form inputs connected to each other
the following inputs:
TextInput::make('booking_duration')
->label('Durasi Booking (satuan jam')
->required()
->numeric(),
and after this input is filled as well:
TimePicker::make('start_time')
->label('Waktu Mulai')
->required(),
and then this input will automatic filled:
TimePicker::make('end_time')
->label('Waktu Selesai')
->required()
->reactive(),
so the input end_time will be filled if start_time was prefilled with the start_time being advanced according to its duration
can you explain?
14 replies