diff --git a/app/Http/Controllers/Admin/ManageRestrauntController.php b/app/Http/Controllers/Admin/ManageRestrauntController.php index 2f80bc0..123ebc1 100644 --- a/app/Http/Controllers/Admin/ManageRestrauntController.php +++ b/app/Http/Controllers/Admin/ManageRestrauntController.php @@ -89,14 +89,14 @@ class ManageRestrauntController extends Controller $restaurant->save(); // Storing operating hours - foreach ($request->input('operating_hours') as $day => $hours) { - OperatingHour::create([ - 'manage_restaurant_xid' => $restaurant->id, - 'day_of_week' => $day, - 'start_time' => $hours['start_time'], - 'end_time' => $hours['end_time'] - ]); - } + // foreach ($request->input('operating_hours') as $day => $hours) { + // OperatingHour::create([ + // 'manage_restaurant_xid' => $restaurant->id, + // 'day_of_week' => $day, + // 'start_time' => $hours['start_time'], + // 'end_time' => $hours['end_time'] + // ]); + // } // Storing restaurant time interval $restTimeInterval = new RestaurantTimeInterval(); @@ -107,7 +107,7 @@ class ManageRestrauntController extends Controller $restTimeInterval->save(); // Storing closed restaurant date and time - if ($request->has('closed_date')) { + if ($request->filled('closed_date')) { $ClosedTime = new RestaurantClosedHour(); $ClosedTime->restaurant_id = $restaurant->id; $ClosedTime->day = $request->closed_date; @@ -157,7 +157,7 @@ class ManageRestrauntController extends Controller public function edit_restaurant(Request $request, $id) { try { - $operating_hours = OperatingHour::where('manage_restaurant_xid', $id)->get()->keyBy('day_of_week'); + // $operating_hours = OperatingHour::where('manage_restaurant_xid', $id)->get()->keyBy('day_of_week'); $restaurantItem = ManageRestaurant::with('timeInterval')->where('id', $id)->first(); $restaurantClosedTime = RestaurantClosedHour::with('restaurant')->where('restaurant_id', $id)->first(); $timeInterval = $restaurantItem->timeInterval->first(); @@ -169,7 +169,7 @@ class ManageRestrauntController extends Controller compact( 'restaurantItem', - 'operating_hours', + // 'operating_hours', 'state', 'timeInterval', 'restaurantClosedTime' @@ -218,27 +218,27 @@ class ManageRestrauntController extends Controller $restaurant->save(); // Handle operating hours - foreach ($request->input('operating_hours') as $day => $hours) { - $operatingHour = OperatingHour::where('manage_restaurant_xid', $restaurant->id) - ->where('day_of_week', $day) - ->first(); + // foreach ($request->input('operating_hours') as $day => $hours) { + // $operatingHour = OperatingHour::where('manage_restaurant_xid', $restaurant->id) + // ->where('day_of_week', $day) + // ->first(); - if ($operatingHour) { - // Update existing record - $operatingHour->update([ - 'start_time' => $hours['start_time'], - 'end_time' => $hours['end_time'] - ]); - } else { - // Create new record - OperatingHour::create([ - 'manage_restaurant_xid' => $restaurant->id, - 'day_of_week' => $day, - 'start_time' => $hours['start_time'], - 'end_time' => $hours['end_time'] - ]); - } - } + // if ($operatingHour) { + // // Update existing record + // $operatingHour->update([ + // 'start_time' => $hours['start_time'], + // 'end_time' => $hours['end_time'] + // ]); + // } else { + // // Create new record + // OperatingHour::create([ + // 'manage_restaurant_xid' => $restaurant->id, + // 'day_of_week' => $day, + // 'start_time' => $hours['start_time'], + // 'end_time' => $hours['end_time'] + // ]); + // } + // } // Handle time interval $timeInterval = RestaurantTimeInterval::where('manage_restaurants_xid', $restaurant->id)->first(); diff --git a/resources/views/Admin/pages/manage_restaurants/add_restaurant.blade.php b/resources/views/Admin/pages/manage_restaurants/add_restaurant.blade.php index 68e8b7b..aafdb0f 100644 --- a/resources/views/Admin/pages/manage_restaurants/add_restaurant.blade.php +++ b/resources/views/Admin/pages/manage_restaurants/add_restaurant.blade.php @@ -109,7 +109,17 @@ -