marshmallow/priceable

v3.1.1 2024-07-18 14:51 UTC

README

alt text

Marshmallow 产品

此包将包含所有产品逻辑。产品通常将与购物车或电子商务包一起使用。

安装

composer require marshmallow/priceable

供应商发布

...

php artisan vendor:publish --provider="Marshmallow\Priceable\PriceableServiceProvider" --tag="config" --force

方法

Currency::getUserCurrent();
Currency::getExceptUserCurrent()

路由

@foreach (\Marshmallow\Priceable\Models\Currency::get() as $currency)
    <a href="{{ route('set-currency', $currency) }}">
        {{ $currency->name }}
    </a>
@endforeach

可用方法

currentPrice() isDiscounted() discountedFrom()

CURRENCY=eur

php artisan db:seed --class=Marshmallow\Product\Database\Seeds\VatRatesSeeder

待办事项

php artisan marshmallow:resource Price Priceable php artisan marshmallow:resource VatRate Priceable php artisan marshmallow:resource Currency Priceable php artisan marshmallow:resource PriceType Priceable

测试

Priceable is_can_make_use_of_the_price_facade

货币 //

增值税 //

价格它有一个货币它有一个增值税率它使用默认增值税率ID它使用默认货币ID它正确地从不含税金额计算含税价格它正确地从不含税金额计算不含税价格它正确地从不含税金额计算增值税金额它正确地从含税金额计算含税价格它正确地从含税金额计算不含税价格它正确地从含税金额计算增值税金额它返回有效的Carbon实例它返回有效的直到Carbon实例

附加

factory(Marshmallow\Product\Models\Product::class, 10)->create();

开发中的测试

php artisan test packages/marshmallow/priceable ...