ekart/backend/app/Actions/GetActiveUserCartAction.php
kusowl 1656739ecd feature: add and fetch products in cart api
- schema for cart and product
- define relationship, DTO, Resource and API collections
- Add post and get endpoint for cart api
2026-03-09 19:07:27 +05:30

18 lines
305 B
PHP

<?php
namespace App\Actions;
use App\Data\CartDTO;
use App\Models\User;
final readonly class GetActiveUserCartAction
{
/**
* Execute the action.
*/
public function execute(User $user)
{
return CartDTO::fromModel($user->carts()->active()->withProducts()->first());
}
}