/**
  * Approve suggested restaurant
  *
  * @param Request $request
  * @return \Illuminate\View\View
  */
 public function approveSuggestedAction(Request $request)
 {
     DB::transaction(function () use($request) {
         $id = $request->input('id');
         $suggested_restaurant = RestaurantsSuggest::find($id);
         $suggested_restaurant->status_verify = CONSTANTS::STATUS_APPROVED;
         $suggested_restaurant->save();
         // Set the restaurant_id with initial value (90,000)
         $restaurant_id = CONSTANTS::SUGGESTED_RESTAURANT_INITIAL_ID;
         $restaurant_max_id = Restaurants::max('id');
         if ($restaurant_id <= $restaurant_max_id) {
             $restaurant_id = ++$restaurant_max_id;
         }
         $suggested_restaurant->id = $restaurant_id;
         $restaurant_cms = new RestaurantsCms();
         $restaurant_cms->addRestaurant($suggested_restaurant);
         $cuisines = explode(', ', $suggested_restaurant->cuisines);
         foreach ($cuisines as $cuisine) {
             $categoriesCms = CategoriesCms::where('name', $cuisine)->first();
             if ($categoriesCms) {
                 $restaurant_category = RestaurantsCategoryCms::getByRestaurantCatId($restaurant_id, $categoriesCms['id']);
             }
             if (!$restaurant_category) {
                 $restaurant_category = new RestaurantsCategoryCms();
                 $restaurant_category->addRestaurantCategory($restaurant_id, $categoriesCms['id']);
             }
         }
         $restaurant_cms->updateRestaurantSlugName();
     });
     return redirect('cms/restaurant/suggested/index')->with('success', 'Successfully added new restaurant!');
 }