定制 aiarmada/filament-cart 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aiarmada/filament-cart

最新稳定版本:v1.1.0

Composer 安装命令:

composer require aiarmada/filament-cart

包简介

A comprehensive Filament admin interface for managing shopping carts created by the AIArmada Cart package

README 文档

README

Filament admin panel integration for aiarmada/cart. Provides normalized cart data resources, condition management, and real-time synchronization for high-volume commerce operations.

Requirements

  • PHP 8.4+
  • Laravel 12+
  • Filament 5+
  • aiarmada/cart

Installation

composer require aiarmada/filament-cart

Register the plugin in your Filament panel provider:

use AIArmada\FilamentCart\FilamentCartPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            FilamentCartPlugin::make(),
        ]);
}

Publish the configuration (optional):

php artisan vendor:publish --tag="filament-cart-config"

Resources

The plugin registers four Filament resources under the E-Commerce navigation group:

Resource Model Purpose
Carts Cart View normalized cart snapshots
Cart Items CartItem Browse individual line items
Cart Conditions CartCondition View conditions applied to carts
Conditions Condition Manage reusable condition templates

Cart Resource

Read-only resource displaying cart snapshots with:

  • Instance filtering (default, wishlist, quote, layaway)
  • Item and condition counts
  • Subtotal and total calculations
  • Metadata search

Cart Item Resource

Read-only resource for line item analysis:

  • Price and quantity filters
  • Attribute inspection
  • Parent cart navigation
  • JSON-searchable metadata

Cart Condition Resource

Read-only resource showing applied conditions:

  • Type badges (discount, fee, tax, shipping)
  • Target visualization (subtotal, total, item)
  • Value display (percentage or fixed)
  • Calculation order

Condition Resource

Full CRUD for reusable condition templates:

  • Create discount, tax, fee, and shipping conditions
  • Configure dynamic rules with factory keys
  • Set global auto-apply behavior
  • Manage condition ordering

Widget

The CartStatsWidget displays key metrics on your dashboard:

  • Active cart count
  • Total cart items
  • Total cart value

Configuration

// config/filament-cart.php

return [
    'navigation_group' => 'E-Commerce',
    'polling_interval' => 30,
    'enable_global_conditions' => true,
    'dynamic_rules_factory' => \AIArmada\Cart\Services\BuiltInRulesFactory::class,
    
    'synchronization' => [
        'queue_sync' => false,
        'queue_connection' => 'default',
        'queue_name' => 'cart-sync',
    ],
];

Event Synchronization

The plugin automatically syncs cart state via event listeners:

  • SyncCartOnEvent — Creates/updates normalized records
  • ApplyGlobalConditions — Auto-applies global conditions
  • CleanupSnapshotOnCartMerged — Handles cart merge cleanup

Dynamic Conditions

Create conditions with rule-based application:

use AIArmada\Cart\Models\Condition;

Condition::create([
    'name' => 'bulk_discount',
    'display_name' => '10% Bulk Discount',
    'type' => 'discount',
    'target' => 'cart@cart_subtotal/aggregate',
    'value' => '-10%',
    'rules' => [
        'factory_keys' => ['min-items', 'total-at-least'],
        'context' => ['min' => 3, 'amount' => 10000],
    ],
    'is_active' => true,
    'is_global' => true,
]);

Actions

Filament actions for cart operations:

  • ApplyConditionAction — Apply a condition template to a cart
  • RemoveConditionAction — Remove a condition from a cart

Testing

./vendor/bin/pest tests/src/FilamentCart --parallel

License

MIT License. See LICENSE for details.

统计信息

  • 总下载量: 93
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 1
  • 推荐数: 2

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-06