cart-development
Build and manage shopping cart functionality including adding items, calculating totals, and managing multiple cart instances.
소스 정보
- 저장소
- realrashid/cart
- 최근 소스 활동
- 2026년 3월 19일 18:37
- 감지된 SKILL.md 언어
- 영어
- 스타
- 112
- 포크
- 7
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
SKILL.md 표시 중
SKILL.md
소스 지침 · 읽기 전용 미리보기- name
- cart-development
- description
- Build and manage shopping cart functionality including adding items, calculating totals, and managing multiple cart instances.
# Cart Development
## When to use this skill
Use this skill when implementing shopping cart features, e-commerce workflows, or wishlist management in Laravel applications using the `realrashid/cart` package.
## Features
- Publish configuration (`vendor:publish` tag: `cart-config`).
- Manage multiple cart instances (e.g., 'main', 'wishlist').
- Add, update, and remove items with custom options and associated models.
- Automatically calculate subtotals, taxes, and totals based on cart contents.
## Examples
### Adding an item to the cart
```php
use RealRashid\Cart\Facades\Cart;
Cart::add('id_1', 'Product 1', 2, 19.99, ['size' => 'L']);
```
### Updating cart item quantity
```php
Cart::update($rowId, 3); // Update quantity to 3
Cart::update($rowId, ['name' => 'New Product Name']); // Update other details
```
### Associating a cart item with an Eloquent model
```php
Cart::associate($rowId, 'App\Models\Product');
$item = Cart::get($rowId);
echo $item->model->name; // Access associated product model
```
### Showing cart contents and totals
```php
$cartItems = Cart::content();
$total = Cart::total();
$tax = Cart::tax();
```
## Implementation tips for AI agents
- Use `Cart::instance('wishlist')` for multiple cart purposes within the same session.
- Leverage model association to avoid manual database lookups when displaying cart items.
- Suggest `php artisan vendor:publish --tag=cart-config` to customize default tax rates and storage settings.
GitHub에서 보기