remove props
This commit is contained in:
@@ -19,10 +19,7 @@ class BrandController extends Controller
|
||||
|
||||
public function store(StoreBrandRequest $request): JsonResponse
|
||||
{
|
||||
$validated = $request->validated();
|
||||
$props = $validated['props'] ?? [];
|
||||
|
||||
$brand = Brand::createWithProps($validated, $props);
|
||||
$brand = Brand::query()->create($request->validated());
|
||||
|
||||
return BrandResource::make($brand)->response()->setStatusCode(201);
|
||||
}
|
||||
@@ -34,10 +31,7 @@ class BrandController extends Controller
|
||||
|
||||
public function update(UpdateBrandRequest $request, Brand $marca): BrandResource
|
||||
{
|
||||
$validated = $request->validated();
|
||||
$props = $validated['props'] ?? [];
|
||||
|
||||
$marca = $marca->updateWithProps($validated, $props);
|
||||
$marca->update($request->validated());
|
||||
|
||||
return BrandResource::make($marca);
|
||||
}
|
||||
|
||||
@@ -21,10 +21,7 @@ class CategoryController extends Controller
|
||||
|
||||
public function store(StoreCategoryRequest $request): JsonResponse
|
||||
{
|
||||
$validated = $request->validated();
|
||||
$props = $validated['props'] ?? [];
|
||||
|
||||
$category = Category::createWithProps($validated, $props);
|
||||
$category = Category::query()->create($request->validated());
|
||||
|
||||
return CategoryResource::make($category->load(['parent', 'subCategories', 'tenant']))
|
||||
->response()
|
||||
@@ -38,10 +35,7 @@ class CategoryController extends Controller
|
||||
|
||||
public function update(UpdateCategoryRequest $request, Category $categoria): CategoryResource
|
||||
{
|
||||
$validated = $request->validated();
|
||||
$props = $validated['props'] ?? [];
|
||||
|
||||
$categoria = $categoria->updateWithProps($validated, $props);
|
||||
$categoria->update($request->validated());
|
||||
|
||||
return CategoryResource::make($categoria->load(['parent', 'subCategories', 'tenant']));
|
||||
}
|
||||
|
||||
@@ -19,10 +19,7 @@ class ProductController extends Controller
|
||||
|
||||
public function store(StoreProductRequest $request): JsonResponse
|
||||
{
|
||||
$validated = $request->validated();
|
||||
$props = $validated['props'] ?? [];
|
||||
|
||||
$product = Product::createWithProps($validated, $props);
|
||||
$product = Product::query()->create($request->validated());
|
||||
|
||||
return ProductResource::make($product)->response()->setStatusCode(201);
|
||||
}
|
||||
@@ -34,10 +31,7 @@ class ProductController extends Controller
|
||||
|
||||
public function update(UpdateProductRequest $request, Product $producto): ProductResource
|
||||
{
|
||||
$validated = $request->validated();
|
||||
$props = $validated['props'] ?? [];
|
||||
|
||||
$producto = $producto->updateWithProps($validated, $props);
|
||||
$producto->update($request->validated());
|
||||
|
||||
return ProductResource::make($producto);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user