public function getTypes(Request $request, Response $response) { Log::debug("Retrieving product types."); if ($request->has("productIds") === false) { Log::debug("Retreiving all product type"); return ProductTypes::all(); } $productIds = explode(";", $request->productIds); Log::debug("ProductTypesController#getTypes -> Passed product Ids: [" . json_encode($productIds) . "]"); return ProductTypes::all()->only($productIds); }
public function persistAndRetrieveProductTypeEntry($requestBody) { return ProductTypes::firstOrCreate(["name" => $requestBody->type]); }