public function addFoodTest(Request $request) { $request = $request->all(); return response()->json($request); $food_data = $request['food']; $token = $request['token']; $current_iterinary = UserSessionHandler::getUserCurrentIterinary($token); $day = UserSessionHandler::getDiffInDays($token, $current_iterinary->id); $activity = new Activity(); $activity->start_time = Carbon::now()->toTimeString(); $activity->iterinary_id = $current_iterinary->id; $activity->day = $day; $eat = new Eat(); $eat->place_name = $food_data['place_name']; $eat->lng = $food_data['lng']; $eat->lat = $food_data['lat']; $eat->tips = $food_data['review']; $eat->price = $food_data['price']; $foodcategory = Foursquare::resolveFoodCategory($food_data['category']['cat_id']); // return response()->json($foodcategory['main_cat']); $eat->main_category_id = $foodcategory['main_cat']; $eat->sub_category_id = $foodcategory['sub_cat']; $pic = $food_data['category']; $eat->pic_url = $pic['prefix'] . '64' . $pic['suffix']; UserSessionHandler::resolveSegmentFromActivity($token); $eat->save(); $eat->activity()->save($activity); $iterinary = Iterinary::findOrFail($current_iterinary->id)->with('activities.typable')->first(); return response()->json($iterinary, 200); // return response()->json($eat); return response()->json($request); }