ekart/backend/app/Actions/GetAllProductCategory.php
kusowl 684b7585bb feature: product creation and image upload
create image upload endpoint
create product creation endpoint
create get product categories endpoint
2026-02-26 19:03:41 +05:30

20 lines
408 B
PHP

<?php
namespace App\Actions;
use App\Data\ProductCategoryDTO;
use App\Models\ProductCategory;
final readonly class GetAllProductCategory
{
/**
* Execute the action.
*/
public function execute(): array
{
return ProductCategory::all(columns: ['id', 'name', 'slug'])
->map(fn ($category) => ProductCategoryDTO::fromModel($category))
->toArray();
}
}