WIP
This commit is contained in:
@@ -30,15 +30,15 @@ class CartController extends Controller
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$data = $cartItems->map(fn ($cartItem) => [
|
||||
'id' => $cartItem->id,
|
||||
'user_id' => $cartItem->user_id,
|
||||
'product_id' => $cartItem->product_id,
|
||||
'product_quantity' => $cartItem->product_quantity,
|
||||
'created_at' => $cartItem->created_at,
|
||||
'updated_at' => $cartItem->updated_at,
|
||||
'product' => new ProductResource($cartItem->product),
|
||||
'id' => $cartItem->id,
|
||||
'user_id' => $cartItem->user_id,
|
||||
'product_id' => $cartItem->product_id,
|
||||
'product_quantity' => $cartItem->product_quantity,
|
||||
'created_at' => $cartItem->created_at,
|
||||
'updated_at' => $cartItem->updated_at,
|
||||
'product' => new ProductResource($cartItem->product),
|
||||
])->groupBy(function (array $cartItem) {
|
||||
if (isset($cartItem['product']) && $cartItem['product']->channels->count() > 0) {
|
||||
return $cartItem['product']->channels[0]->slug;
|
||||
@@ -48,7 +48,7 @@ class CartController extends Controller
|
||||
});
|
||||
|
||||
return response()->rest(
|
||||
$data,
|
||||
$data,
|
||||
code: 200,
|
||||
message: 'Cart items'
|
||||
);
|
||||
|
||||
@@ -40,7 +40,7 @@ class CheckoutOrderRequest extends FormRequest
|
||||
'customer_address' => ['required', 'string', 'max:255'],
|
||||
|
||||
'shipping_method' => ['required', 'string', 'max:255', Rule::in(array_keys(OrderShipping::values()))],
|
||||
|
||||
|
||||
'shipping_price' => ['nullable', 'numeric'],
|
||||
'product_ids' => ['required', 'array'],
|
||||
'product_ids.*' => ['required', 'integer', 'exists:products,id'],
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace App\Repositories\Ecommerce\Order;
|
||||
use App\Events\Ecommerce\Product\Order\OrderCreated;
|
||||
use App\Models\Ecommerce\Product\Order\Order;
|
||||
use App\Models\Ecommerce\Product\Order\Shipping\OrderShipping;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class OrderRepository
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Repositories\Ecommerce\Product\Category;
|
||||
|
||||
use App\Models\Ecommerce\Product\Category\Category;
|
||||
use App\Repositories\System\Cache\CacheRepository;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CategoryRepository
|
||||
@@ -126,14 +125,11 @@ class CategoryRepository
|
||||
*/
|
||||
public static function namesWithTaxes(): array
|
||||
{
|
||||
return CacheRepository::make(
|
||||
name: 'cs-nova-models-categories',
|
||||
value: fn () => static::maskParentName(
|
||||
Category::tree()
|
||||
->where('is_visible', true)
|
||||
->get(['id', 'slug', 'name', 'tax_percentage', 'parent_id', 'is_visible'])
|
||||
->toTree()
|
||||
)
|
||||
return static::maskParentName(
|
||||
Category::tree()
|
||||
->where('is_visible', true)
|
||||
->get(['id', 'slug', 'name', 'tax_percentage', 'parent_id', 'is_visible'])
|
||||
->toTree()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user