Eth
Eth
FFilament
Created by Eth on 1/29/2024 in #❓┊help
issue with updating the price after picking a date
I’m trying to fetch the price from Seasonal json file ($Seasonal) after picking the date update the total price but it doesn’t work, not sure if the issue with my way of fetching the price or the summing it
Forms\Components\DatePicker::make('Date')
->required()
->live()
->dehydrated()
->minDate(now())
->afterStateUpdated(function ($state, callable $set, callable $get){
$place = Place::find($get('placeName'));
$Seasonal = $place->Seasonal;
$From = collect($Seasonal)->pluck('From');
$Until = collect($Seasonal)->pluck('Until');
$Price = collect($Seasonal)->pluck('Price');
$placePrice = Place::find($get('placePrice'));
$reservations = Reservation::where(function ($query) use ($Seasonal, $placePrice, $Price) {
foreach ($Seasonal as $season) {
$reservations = Place::where(function ($query) use ($season) {
$query->where('Seasonal', '>=', $season['From'])
->where('Seasonal', '<=', $season['Until']);
})->get();
}
if ($placePrice) {
$placePrice += $Price->sum();
}
});
}),
Forms\Components\DatePicker::make('Date')
->required()
->live()
->dehydrated()
->minDate(now())
->afterStateUpdated(function ($state, callable $set, callable $get){
$place = Place::find($get('placeName'));
$Seasonal = $place->Seasonal;
$From = collect($Seasonal)->pluck('From');
$Until = collect($Seasonal)->pluck('Until');
$Price = collect($Seasonal)->pluck('Price');
$placePrice = Place::find($get('placePrice'));
$reservations = Reservation::where(function ($query) use ($Seasonal, $placePrice, $Price) {
foreach ($Seasonal as $season) {
$reservations = Place::where(function ($query) use ($season) {
$query->where('Seasonal', '>=', $season['From'])
->where('Seasonal', '<=', $season['Until']);
})->get();
}
if ($placePrice) {
$placePrice += $Price->sum();
}
});
}),
(Side note: I get the default total price from choosing a name previously, not sure if this could cause an issue)
1 replies
FFilament
Created by Eth on 12/20/2023 in #❓┊help
GenericEmail not found
No description
13 replies
FFilament
Created by Eth on 12/17/2023 in #❓┊help
retrieving previous record
No description
3 replies
FFilament
Created by Eth on 12/16/2023 in #❓┊help
issue with pluck() on array
No description
3 replies
FFilament
Created by Eth on 11/27/2023 in #❓┊help
showing external options
No description
14 replies
FFilament
Created by Eth on 11/25/2023 in #❓┊help
how can I display a repeater in table
No description
3 replies
FFilament
Created by Eth on 11/21/2023 in #❓┊help
what’s the possible issue
No description
22 replies