// this works correctly displaying the meals based on the order
Select::make('meal')
->label('Menu Option')
// ->searchable()
->options(function() use ($order) {
Log::debug($order->id);
$meals = Meal::where([
['kitchen_id', $order->provider_id],
['approved', true],
])->get();
$returnArray = [];
foreach($meals as $meal) {
$returnArray[$meal->id] = $meal->name . ' - $' . number_format($meal->price, 2, '.', ',');
}
return $returnArray;
})
// this does not work correctly
// it always uses the first order to pull the meals
Select::make('meal')
->label('Menu Option')
->searchable()
->options(function() use ($order) {
Log::debug($order->id);
$meals = Meal::where([
['kitchen_id', $order->provider_id],
['approved', true],
])->get();
$returnArray = [];
foreach($meals as $meal) {
$returnArray[$meal->id] = $meal->name . ' - $' . number_format($meal->price, 2, '.', ',');
}
return $returnArray;
})
// this works correctly displaying the meals based on the order
Select::make('meal')
->label('Menu Option')
// ->searchable()
->options(function() use ($order) {
Log::debug($order->id);
$meals = Meal::where([
['kitchen_id', $order->provider_id],
['approved', true],
])->get();
$returnArray = [];
foreach($meals as $meal) {
$returnArray[$meal->id] = $meal->name . ' - $' . number_format($meal->price, 2, '.', ',');
}
return $returnArray;
})
// this does not work correctly
// it always uses the first order to pull the meals
Select::make('meal')
->label('Menu Option')
->searchable()
->options(function() use ($order) {
Log::debug($order->id);
$meals = Meal::where([
['kitchen_id', $order->provider_id],
['approved', true],
])->get();
$returnArray = [];
foreach($meals as $meal) {
$returnArray[$meal->id] = $meal->name . ' - $' . number_format($meal->price, 2, '.', ',');
}
return $returnArray;
})