public static function getRequestInstance(Request $request, $field = 'ID') { $product = parent::getRequestInstance($request, $field); if (!$product->getID()) { $data = $request->getJSON(); $category = Category::getRequestInstance($request, $field); $product = Product::getNewInstance($category); } return $product; }