mirror of
https://github.com/wearepixel/laravel-cart.git
synced 2026-11-14 22:01:48 +00:00
Compare commits
47
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
489b2723d5 | ||
|
|
54d7c8a54f | ||
|
|
a8d743eb9b | ||
|
|
b7381573e8 | ||
|
|
d4d4df7d58 | ||
|
|
6ea2cb3b8b | ||
|
|
7a2c41e02d | ||
|
|
d3f673d52f | ||
|
|
9a59857825 | ||
|
|
43238b6f2e | ||
|
|
c0f0fcd2f0 | ||
|
|
185c4572ae | ||
|
|
c111cda3aa | ||
|
|
ab9eb6c873 | ||
|
|
7ee26add8d | ||
|
|
05318b7b13 | ||
|
|
4d2efcdeae | ||
|
|
a269c188e4 | ||
|
|
2ccba20119 | ||
|
|
313a4f7aa2 | ||
|
|
4a312a37e2 | ||
|
|
274a8504af | ||
|
|
4f22672ca5 | ||
|
|
61475a7060 | ||
|
|
6604cf984d | ||
|
|
7d955d722c | ||
|
|
54d94d8d12 | ||
|
|
e49ebe02e0 | ||
|
|
28b451583d | ||
|
|
3673f360b7 | ||
|
|
f6447ad4d9 | ||
|
|
b102dd2356 | ||
|
|
25fc662c05 | ||
|
|
57328c2f64 | ||
|
|
4d19211f2c | ||
|
|
8cee4f6208 | ||
|
|
0ec0668bcf | ||
|
|
9a4b5382bd | ||
|
|
95054f41a4 | ||
|
|
0a9bcc2832 | ||
|
|
8c8c90c170 | ||
|
|
18c753f39b | ||
|
|
d12a566366 | ||
|
|
66fd4c9099 | ||
|
|
d48f54cf16 | ||
|
|
24f64e712c | ||
|
|
85ae0c30c5 |
@@ -3,15 +3,15 @@ version: 2
|
|||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "github-actions"
|
- package-ecosystem: "github-actions"
|
||||||
directory: "/"
|
directory: "/"
|
||||||
target-branch: "develop"
|
target-branch: "master"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "weekly"
|
interval: "weekly"
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "deps"
|
||||||
- package-ecosystem: "composer"
|
- package-ecosystem: "composer"
|
||||||
directory: "/"
|
directory: "/"
|
||||||
target-branch: "develop"
|
target-branch: "master"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "weekly"
|
interval: "weekly"
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "deps"
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
name: PHP Formatting
|
|
||||||
|
|
||||||
on: pull_request
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
php-formatting:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- name: "Run Pint"
|
|
||||||
uses: aglipanci/laravel-pint-action@latest
|
|
||||||
with:
|
|
||||||
verboseMode: true
|
|
||||||
configPath: "pint.json"
|
|
||||||
pintVersion: 1.17.2
|
|
||||||
|
|
||||||
- name: Commit changes
|
|
||||||
uses: stefanzweifel/git-auto-commit-action@v5
|
|
||||||
with:
|
|
||||||
commit_message: "Apply Laravel Pint"
|
|
||||||
commit_options: '--no-verify --signoff'
|
|
||||||
file_pattern: "*.php"
|
|
||||||
commit_user_name: "Pixel Tech"
|
|
||||||
commit_user_email: "tech@wearepixel.com.au"
|
|
||||||
commit_author: "Pixel Tech<tech@wearepixel.com.au>"
|
|
||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
matrix:
|
matrix:
|
||||||
php: ['8.1','8.2', '8.3']
|
php: ['8.1', '8.2', '8.3']
|
||||||
stability: [prefer-stable]
|
stability: [prefer-stable]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -3,3 +3,4 @@
|
|||||||
.idea
|
.idea
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
READMETODO.md
|
READMETODO.md
|
||||||
|
build
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) Pixel <hello@wearepixel.com.au>
|
Copyright (c) Pixel Digital Pty Ltd <hello@wearepixel.com.au>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -43,9 +43,42 @@ ## Configuration
|
|||||||
php artisan vendor:publish --provider="Wearepixel\Cart\CartServiceProvider" --tag="config"
|
php artisan vendor:publish --provider="Wearepixel\Cart\CartServiceProvider" --tag="config"
|
||||||
```
|
```
|
||||||
|
|
||||||
## HOW TO USE
|
### Formatting Numbers
|
||||||
|
|
||||||
- [Usage](#usage)
|
The package by default does not use round to format numbers, and instead returns the number using floatval().
|
||||||
|
|
||||||
|
If you'd prefer this number to be rounded, you can customize the formatting in the configuration file.
|
||||||
|
|
||||||
|
Defaults to false.
|
||||||
|
|
||||||
|
```php
|
||||||
|
'format_numbers' => env('LARAVEL_CART_FORMAT_VALUES', false),
|
||||||
|
'round_mode' => env('LARAVEL_CART_ROUND_MODE', 'down'),
|
||||||
|
```
|
||||||
|
|
||||||
|
### Decimals
|
||||||
|
|
||||||
|
You can customize the number of decimals in the configuration file.
|
||||||
|
|
||||||
|
Defaults to 2.
|
||||||
|
|
||||||
|
```php
|
||||||
|
'decimals' => env('LARAVEL_CART_DECIMALS', 2),
|
||||||
|
```
|
||||||
|
|
||||||
|
### Round Mode
|
||||||
|
|
||||||
|
The package uses the `round` function to round the prices. You can customize the rounding mode in the configuration file.
|
||||||
|
|
||||||
|
Defaults to `down`.
|
||||||
|
|
||||||
|
```php
|
||||||
|
'round_mode' => env('LARAVEL_CART_ROUND_MODE', 'down'),
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
- [Basic Usage](#basic-usage)
|
||||||
- [Conditions](#conditions)
|
- [Conditions](#conditions)
|
||||||
- [Items](#items)
|
- [Items](#items)
|
||||||
- [Associating Models](#associating-models)
|
- [Associating Models](#associating-models)
|
||||||
@@ -255,12 +288,14 @@ ### Clearing the Cart: **Cart::clear()**
|
|||||||
|
|
||||||
## Conditions
|
## Conditions
|
||||||
|
|
||||||
Conditions are very useful in terms for adding things like discounts, taxes, shipping costs, etc.
|
Conditions are very useful for adding things like discounts, taxes, shipping, etc.
|
||||||
|
|
||||||
Conditions can be added on the entire cart or on individual items.
|
Conditions can be added on the entire cart or on individual items, and can even be applied only at certain cart values.
|
||||||
|
|
||||||
Conditions on a cart level should always have a `target` of `subtotal` or `total`. This tells the cart which value to apply the condition to.
|
Conditions on a cart level should always have a `target` of `subtotal` or `total`. This tells the cart which value to apply the condition to.
|
||||||
|
|
||||||
|
You can provide an optional `minimum` value which should be the dollar value in which the target (subtotal or total) needs to be for the condition to be active and impact the cart.
|
||||||
|
|
||||||
You can also provide an `order` to cart conditions which tells the cart in what order to apply the conditions. Item level conditions do not support the `order` parameter.
|
You can also provide an `order` to cart conditions which tells the cart in what order to apply the conditions. Item level conditions do not support the `order` parameter.
|
||||||
|
|
||||||
### Conditions on the cart
|
### Conditions on the cart
|
||||||
@@ -329,26 +364,167 @@ #### Getting conditions on the cart: **Cart::getConditions()**
|
|||||||
$condition->getType(); // the type
|
$condition->getType(); // the type
|
||||||
$condition->getValue(); // the value of the condition
|
$condition->getValue(); // the value of the condition
|
||||||
$condition->getOrder(); // the order of the condition
|
$condition->getOrder(); // the order of the condition
|
||||||
|
$condition->getMinimum(); // the minimum dollar amount of the target, needed to activate the condition
|
||||||
|
$condition->getMaximum(); // the maximum dollar amount of the target, needed to keep the condition active
|
||||||
$condition->getAttributes(); // the attributes of the condition, returns an empty [] if no attributes added
|
$condition->getAttributes(); // the attributes of the condition, returns an empty [] if no attributes added
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Getting conditions on the cart as an array: **Cart::getConditions(array: true)**
|
||||||
|
|
||||||
|
You can get all cart conditions in array format by passing "array: true". This is useful if you want to store the carts conditions on a Livewire component since by default we have collections inside collections for conditions which Livewire does not support.
|
||||||
|
|
||||||
|
```php
|
||||||
|
$cartConditions = Cart::getConditions(true);
|
||||||
|
$cartConditions = Cart::getConditions(active: true);
|
||||||
|
|
||||||
|
foreach ($cartConditions as $condition) {
|
||||||
|
$condition['name']; // the name of the condition
|
||||||
|
$condition['type']; // the type
|
||||||
|
$condition['value']; // the value of the condition
|
||||||
|
$condition['order']; // the order of the condition
|
||||||
|
$condition['minimum']; // the minimum dollar amount of the target, needed to activate the condition
|
||||||
|
$condition['maximum']; // the maximum dollar amount of the target, needed to keep the condition active
|
||||||
|
$condition['attributes']; // the attributes of the condition, returns an empty [] if no attributes added
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Getting conditions by name: **Cart::getCondition($conditionName)**
|
||||||
|
|
||||||
|
```php
|
||||||
|
$condition = Cart::getCondition('GST');
|
||||||
|
|
||||||
// You can also get a condition that has been applied on the cart by using its name:
|
|
||||||
$condition = Cart::getCondition('Tax: 10%');
|
|
||||||
$condition->getTarget(); // the target of which the condition was applied
|
$condition->getTarget(); // the target of which the condition was applied
|
||||||
$condition->getName(); // the name of the condition
|
$condition->getName(); // the name of the condition
|
||||||
$condition->getType(); // the type
|
$condition->getType(); // the type
|
||||||
$condition->getValue(); // the value of the condition
|
$condition->getValue(); // the value of the condition
|
||||||
|
$condition->getMinimum(); // the minimum dollar amount of the target, needed to activate the condition
|
||||||
|
$condition->getMaximum(); // the maximum dollar amount of the target, needed to keep the condition active
|
||||||
$condition->getAttributes(); // the attributes of the condition, returns an empty [] if no attributes added
|
$condition->getAttributes(); // the attributes of the condition, returns an empty [] if no attributes added
|
||||||
```
|
```
|
||||||
|
|
||||||
### Calculating condition value: **Cart::getCondition('Tax: 10%')->getCalculatedValue($subTotal)**
|
#### Getting active conditions on the cart: **Cart::getConditions(active: true)**
|
||||||
|
|
||||||
|
You can get only active conditions by passsing `active: true` to the `getConditions()` method.
|
||||||
|
|
||||||
|
This will return conditions that are actively being applied to the cart (i.e if they meet their minimum or maximum value)
|
||||||
|
|
||||||
|
```php
|
||||||
|
$tenPercentOff = new CartCondition([
|
||||||
|
'name' => '10% Off',
|
||||||
|
'type' => 'discount',
|
||||||
|
'target' => 'subtotal',
|
||||||
|
'value' => '-10%',
|
||||||
|
'minimum' => 120,
|
||||||
|
'order' => 1,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Cart::getConditions(active: true);
|
||||||
|
|
||||||
|
// will return "10% Off" if the subtotal of the cart is $200.
|
||||||
|
// will return no conditions if the subtotal is $100.
|
||||||
|
|
||||||
|
$shipping = new CartCondition([
|
||||||
|
'name' => 'Shipping',
|
||||||
|
'type' => 'discount',
|
||||||
|
'target' => 'subtotal',
|
||||||
|
'value' => '10',
|
||||||
|
'maximum' => 200,
|
||||||
|
'order' => 1,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Cart::getConditions(active: true);
|
||||||
|
|
||||||
|
// will return "Shipping" if the subtotal of the cart is less than or equal 200
|
||||||
|
// will return no conditions if the subtotal is $210
|
||||||
|
```
|
||||||
|
|
||||||
|
### Calculating condition value
|
||||||
|
|
||||||
|
There are 2 ways to calculate the value of a condition:
|
||||||
|
|
||||||
|
1. Using the `getCalculatedValue` method on the condition instance
|
||||||
|
2. Using the `getCalculatedValueForCondition` method on the cart instance and passing the condition name
|
||||||
|
|
||||||
|
#### Using the `getCalculatedValue` method on the condition instance
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$subTotal = Cart::getSubTotal();
|
$subTotal = Cart::getSubTotal();
|
||||||
$condition = Cart::getCondition('VAT 12.5%');
|
$condition = Cart::getCondition('10% GST');
|
||||||
$conditionCalculatedValue = $condition->getCalculatedValue($subTotal);
|
$conditionCalculatedValue = $condition->getCalculatedValue($subTotal);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Using the `getCalculatedValueForCondition` method on the cart instance
|
||||||
|
|
||||||
|
This method automatically calculates the value of a condition by it's name based on the order of the conditions.
|
||||||
|
|
||||||
|
```php
|
||||||
|
Cart::add([
|
||||||
|
'id' => 1,
|
||||||
|
'name' => 'Apple iPhone 15',
|
||||||
|
'price' => 200,
|
||||||
|
'quantity' => 1,
|
||||||
|
'attributes' => [],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$couponDiscount = new CartCondition([
|
||||||
|
'name' => 'Coupon Discount',
|
||||||
|
'type' => 'discount',
|
||||||
|
'target' => 'subtotal',
|
||||||
|
'value' => '-200',
|
||||||
|
'order' => 1,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$giftCard = new CartCondition([
|
||||||
|
'name' => 'Gift Card',
|
||||||
|
'type' => 'discount',
|
||||||
|
'target' => 'subtotal',
|
||||||
|
'value' => '-200',
|
||||||
|
'order' => 2,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Cart::getCalculatedValueForCondition('Coupon Discount'); // returns 200
|
||||||
|
Cart::getCalculatedValueForCondition('Gift Card'); // returns 0 as the coupon discount is applied first and brings the subtotal to 0
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding conditions that activate once a minimum value is met
|
||||||
|
|
||||||
|
You can add a `minimum` amount required for a condition to activate.
|
||||||
|
|
||||||
|
This is useful for applying discounts only after certain cart values, i.e: 10% off for any purchases over $120.
|
||||||
|
|
||||||
|
```php
|
||||||
|
$tenPercentOff = new CartCondition([
|
||||||
|
'name' => '10% Off',
|
||||||
|
'type' => 'discount',
|
||||||
|
'target' => 'subtotal',
|
||||||
|
'value' => '-10%',
|
||||||
|
'minimum' => 120,
|
||||||
|
'order' => 1,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Cart::condition($tenPercentOff)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding conditions that only activate up to a maximum value
|
||||||
|
|
||||||
|
You can add a `maximum` amount required for a condition to activate.
|
||||||
|
|
||||||
|
This is useful for applying discounts up until amounts, i.e shipping for anything below $200, and free shipping above.
|
||||||
|
|
||||||
|
```php
|
||||||
|
$shipping = new CartCondition([
|
||||||
|
'name' => 'Shipping',
|
||||||
|
'type' => 'discount',
|
||||||
|
'target' => 'subtotal',
|
||||||
|
'value' => '12',
|
||||||
|
'maximum' => 200,
|
||||||
|
'order' => 1,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Cart::condition($shipping)
|
||||||
|
```
|
||||||
|
|
||||||
### Condition on items
|
### Condition on items
|
||||||
|
|
||||||
Item conditions are useful if you have discounts to be applied specifically on an item and not on the whole cart value.
|
Item conditions are useful if you have discounts to be applied specifically on an item and not on the whole cart value.
|
||||||
@@ -410,7 +586,7 @@ ### Condition on items
|
|||||||
$cartSubTotal = Cart::getSubTotal();
|
$cartSubTotal = Cart::getSubTotal();
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Add condition to existing Item on the cart: **Cart::addItemCondition($productId, $itemCondition)**
|
#### Add a condition to an existing item on the cart: **Cart::addItemCondition($productId, $itemCondition)**
|
||||||
|
|
||||||
Adding Condition to an existing Item on the cart is simple as well.
|
Adding Condition to an existing Item on the cart is simple as well.
|
||||||
|
|
||||||
@@ -426,10 +602,18 @@ #### Add condition to existing Item on the cart: **Cart::addItemCondition($produ
|
|||||||
|
|
||||||
### Clearing Cart Conditions: **Cart::clearCartConditions()**
|
### Clearing Cart Conditions: **Cart::clearCartConditions()**
|
||||||
|
|
||||||
|
This clears all cart level conditions, and does not affect item level conditions.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
Cart::clearCartConditions()
|
Cart::clearCartConditions()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you wish to clear all conditions from all items and the cart, use **Cart::clearAllConditions()**
|
||||||
|
|
||||||
|
```php
|
||||||
|
Cart::clearAllConditions()
|
||||||
|
```
|
||||||
|
|
||||||
### Remove a specific cart condtion: **Cart::removeCartCondition($conditionName)**
|
### Remove a specific cart condtion: **Cart::removeCartCondition($conditionName)**
|
||||||
|
|
||||||
```php
|
```php
|
||||||
|
|||||||
+5
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wearepixel/laravel-cart",
|
"name": "wearepixel/laravel-cart",
|
||||||
"version": "1.0.0",
|
"version": "1.0.8",
|
||||||
"description": "A cart implementation for Laravel",
|
"description": "A cart implementation for Laravel",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"laravel",
|
"laravel",
|
||||||
@@ -19,15 +19,16 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.0",
|
"php": ">=8.1",
|
||||||
"illuminate/support": "^9.0|^10.0|^11.0",
|
"illuminate/support": "^9.0|^10.0|^11.0",
|
||||||
"illuminate/validation": "^9.0|^10.0|^11.0",
|
"illuminate/validation": "^9.0|^10.0|^11.0",
|
||||||
"illuminate/translation": "^9.0|^10.0|^11.0"
|
"illuminate/translation": "^9.0|^10.0|^11.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mockery/mockery": "^1.4.2",
|
"mockery/mockery": "^1.4.2",
|
||||||
"laravel/pint": "dev-main",
|
"laravel/pint": "^1.17",
|
||||||
"pestphp/pest": "2.34.4"
|
"pestphp/pest": "2.35.1",
|
||||||
|
"larapack/dd": "1.1"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|||||||
Generated
+309
-185
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "b25e260acd3e7cf87e600ba7103131f4",
|
"content-hash": "bf8d3b76695f06430eaf04e5eeacb58c",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
@@ -378,12 +378,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/collections.git",
|
"url": "https://github.com/illuminate/collections.git",
|
||||||
"reference": "dc68a7ccad93f3c2baa0bc8f559431c06391aa75"
|
"reference": "66d2c9bdf5641599735d402c1c504b54734a9cca"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/collections/zipball/dc68a7ccad93f3c2baa0bc8f559431c06391aa75",
|
"url": "https://api.github.com/repos/illuminate/collections/zipball/66d2c9bdf5641599735d402c1c504b54734a9cca",
|
||||||
"reference": "dc68a7ccad93f3c2baa0bc8f559431c06391aa75",
|
"reference": "66d2c9bdf5641599735d402c1c504b54734a9cca",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -425,7 +425,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-08-01T18:54:27+00:00"
|
"time": "2024-08-23T18:49:36+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/conditionable",
|
"name": "illuminate/conditionable",
|
||||||
@@ -479,12 +479,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/container.git",
|
"url": "https://github.com/illuminate/container.git",
|
||||||
"reference": "f47be671981a4438257c4fbfc3ad257f4e3e929a"
|
"reference": "85e3396fde3139eae3f37128222c9a7746ca4bbb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/container/zipball/f47be671981a4438257c4fbfc3ad257f4e3e929a",
|
"url": "https://api.github.com/repos/illuminate/container/zipball/85e3396fde3139eae3f37128222c9a7746ca4bbb",
|
||||||
"reference": "f47be671981a4438257c4fbfc3ad257f4e3e929a",
|
"reference": "85e3396fde3139eae3f37128222c9a7746ca4bbb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -522,7 +522,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-08-05T15:04:01+00:00"
|
"time": "2024-08-21T16:01:30+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/contracts",
|
"name": "illuminate/contracts",
|
||||||
@@ -530,12 +530,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/contracts.git",
|
"url": "https://github.com/illuminate/contracts.git",
|
||||||
"reference": "34ead9385e0eab7e947807d77da66faf9bdf95ff"
|
"reference": "af9b459f195d57f279ec30a45446ddaeb3337bcb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/34ead9385e0eab7e947807d77da66faf9bdf95ff",
|
"url": "https://api.github.com/repos/illuminate/contracts/zipball/af9b459f195d57f279ec30a45446ddaeb3337bcb",
|
||||||
"reference": "34ead9385e0eab7e947807d77da66faf9bdf95ff",
|
"reference": "af9b459f195d57f279ec30a45446ddaeb3337bcb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -570,7 +570,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-08-01T19:08:33+00:00"
|
"time": "2024-08-21T16:02:16+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/filesystem",
|
"name": "illuminate/filesystem",
|
||||||
@@ -578,12 +578,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/filesystem.git",
|
"url": "https://github.com/illuminate/filesystem.git",
|
||||||
"reference": "43b8d2af61dd6ca882e192fa4ca803d2294d4507"
|
"reference": "7e44057ac57635465c91c3fc6247c5d87bd1feed"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/filesystem/zipball/43b8d2af61dd6ca882e192fa4ca803d2294d4507",
|
"url": "https://api.github.com/repos/illuminate/filesystem/zipball/7e44057ac57635465c91c3fc6247c5d87bd1feed",
|
||||||
"reference": "43b8d2af61dd6ca882e192fa4ca803d2294d4507",
|
"reference": "7e44057ac57635465c91c3fc6247c5d87bd1feed",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -637,7 +637,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-06-28T20:10:30+00:00"
|
"time": "2024-09-03T13:20:49+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/macroable",
|
"name": "illuminate/macroable",
|
||||||
@@ -691,12 +691,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/support.git",
|
"url": "https://github.com/illuminate/support.git",
|
||||||
"reference": "089c989beac69bd2633466d72d6ed07068b623ac"
|
"reference": "51efc0516526413b4be641a1731d15d4394de2ff"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/support/zipball/089c989beac69bd2633466d72d6ed07068b623ac",
|
"url": "https://api.github.com/repos/illuminate/support/zipball/51efc0516526413b4be641a1731d15d4394de2ff",
|
||||||
"reference": "089c989beac69bd2633466d72d6ed07068b623ac",
|
"reference": "51efc0516526413b4be641a1731d15d4394de2ff",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -757,7 +757,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-08-07T14:43:54+00:00"
|
"time": "2024-09-03T13:21:20+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/translation",
|
"name": "illuminate/translation",
|
||||||
@@ -816,12 +816,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/validation.git",
|
"url": "https://github.com/illuminate/validation.git",
|
||||||
"reference": "9398c6e24bf1b0ac12a7160f85bd0cc5e8f4305d"
|
"reference": "60474ce720aab7264ed8d75a344e8a8af911e417"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/validation/zipball/9398c6e24bf1b0ac12a7160f85bd0cc5e8f4305d",
|
"url": "https://api.github.com/repos/illuminate/validation/zipball/60474ce720aab7264ed8d75a344e8a8af911e417",
|
||||||
"reference": "9398c6e24bf1b0ac12a7160f85bd0cc5e8f4305d",
|
"reference": "60474ce720aab7264ed8d75a344e8a8af911e417",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -869,7 +869,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-08-05T13:45:12+00:00"
|
"time": "2024-08-13T17:23:08+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nesbot/carbon",
|
"name": "nesbot/carbon",
|
||||||
@@ -877,12 +877,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/briannesbitt/Carbon.git",
|
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||||
"reference": "cb4374784c87d0a0294e8513a52eb63c0aff3139"
|
"reference": "bbd3eef89af8ba66a3aa7952b5439168fbcc529f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cb4374784c87d0a0294e8513a52eb63c0aff3139",
|
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bbd3eef89af8ba66a3aa7952b5439168fbcc529f",
|
||||||
"reference": "cb4374784c87d0a0294e8513a52eb63c0aff3139",
|
"reference": "bbd3eef89af8ba66a3aa7952b5439168fbcc529f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -976,7 +976,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-07-16T22:29:20+00:00"
|
"time": "2024-08-19T06:22:39+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/clock",
|
"name": "psr/clock",
|
||||||
@@ -1206,18 +1206,86 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-08-06T10:13:52+00:00"
|
"time": "2024-08-06T10:13:52+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/deprecation-contracts",
|
||||||
|
"version": "dev-main",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||||
|
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
||||||
|
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1"
|
||||||
|
},
|
||||||
|
"default-branch": true,
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.5-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/contracts",
|
||||||
|
"url": "https://github.com/symfony/contracts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"function.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A generic function and convention to trigger deprecation notices",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-04-18T09:32:20+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/finder",
|
"name": "symfony/finder",
|
||||||
"version": "7.2.x-dev",
|
"version": "7.2.x-dev",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/finder.git",
|
"url": "https://github.com/symfony/finder.git",
|
||||||
"reference": "51c0ff591e6295f21e1789e55a6e57457980895e"
|
"reference": "afa87bce0d224a744963ecc8db07b1f0f96a3518"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/finder/zipball/51c0ff591e6295f21e1789e55a6e57457980895e",
|
"url": "https://api.github.com/repos/symfony/finder/zipball/afa87bce0d224a744963ecc8db07b1f0f96a3518",
|
||||||
"reference": "51c0ff591e6295f21e1789e55a6e57457980895e",
|
"reference": "afa87bce0d224a744963ecc8db07b1f0f96a3518",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1268,7 +1336,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-08-12T10:26:02+00:00"
|
"time": "2024-09-03T13:22:29+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/http-foundation",
|
"name": "symfony/http-foundation",
|
||||||
@@ -1276,12 +1344,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/http-foundation.git",
|
"url": "https://github.com/symfony/http-foundation.git",
|
||||||
"reference": "4187b642a75b3d56ae1bf1461091eedbef2e06d6"
|
"reference": "5a92e38016224d35a68ded60297b94d87b21a494"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/4187b642a75b3d56ae1bf1461091eedbef2e06d6",
|
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/5a92e38016224d35a68ded60297b94d87b21a494",
|
||||||
"reference": "4187b642a75b3d56ae1bf1461091eedbef2e06d6",
|
"reference": "5a92e38016224d35a68ded60297b94d87b21a494",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1345,7 +1413,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-08-06T10:13:58+00:00"
|
"time": "2024-09-03T14:09:19+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/mime",
|
"name": "symfony/mime",
|
||||||
@@ -1353,12 +1421,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/mime.git",
|
"url": "https://github.com/symfony/mime.git",
|
||||||
"reference": "ab31998ee18185ce4cdea28bb52ffbda575378ee"
|
"reference": "52dc06994d8ee1f97bdc6a80c758c1a6bc482f78"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/mime/zipball/ab31998ee18185ce4cdea28bb52ffbda575378ee",
|
"url": "https://api.github.com/repos/symfony/mime/zipball/52dc06994d8ee1f97bdc6a80c758c1a6bc482f78",
|
||||||
"reference": "ab31998ee18185ce4cdea28bb52ffbda575378ee",
|
"reference": "52dc06994d8ee1f97bdc6a80c758c1a6bc482f78",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -1429,7 +1497,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-08-12T12:27:03+00:00"
|
"time": "2024-08-13T14:29:53+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-intl-idn",
|
"name": "symfony/polyfill-intl-idn",
|
||||||
@@ -1836,16 +1904,17 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/translation.git",
|
"url": "https://github.com/symfony/translation.git",
|
||||||
"reference": "a50ed69ace45368e096bc3981f456089253ed6cb"
|
"reference": "a1c4be3a5885b9785b131c5a30d93e611848cb1d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/translation/zipball/a50ed69ace45368e096bc3981f456089253ed6cb",
|
"url": "https://api.github.com/repos/symfony/translation/zipball/a1c4be3a5885b9785b131c5a30d93e611848cb1d",
|
||||||
"reference": "a50ed69ace45368e096bc3981f456089253ed6cb",
|
"reference": "a1c4be3a5885b9785b131c5a30d93e611848cb1d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.2",
|
"php": ">=8.2",
|
||||||
|
"symfony/deprecation-contracts": "^2.5|^3",
|
||||||
"symfony/polyfill-mbstring": "~1.0",
|
"symfony/polyfill-mbstring": "~1.0",
|
||||||
"symfony/translation-contracts": "^2.5|^3.0"
|
"symfony/translation-contracts": "^2.5|^3.0"
|
||||||
},
|
},
|
||||||
@@ -1922,7 +1991,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-08-05T08:22:14+00:00"
|
"time": "2024-08-19T08:28:32+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/translation-contracts",
|
"name": "symfony/translation-contracts",
|
||||||
@@ -2223,16 +2292,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "fidry/cpu-core-counter",
|
"name": "fidry/cpu-core-counter",
|
||||||
"version": "1.1.0",
|
"version": "1.2.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/theofidry/cpu-core-counter.git",
|
"url": "https://github.com/theofidry/cpu-core-counter.git",
|
||||||
"reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42"
|
"reference": "8520451a140d3f46ac33042715115e290cf5785f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/f92996c4d5c1a696a6a970e20f7c4216200fcc42",
|
"url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/8520451a140d3f46ac33042715115e290cf5785f",
|
||||||
"reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42",
|
"reference": "8520451a140d3f46ac33042715115e290cf5785f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2272,7 +2341,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/theofidry/cpu-core-counter/issues",
|
"issues": "https://github.com/theofidry/cpu-core-counter/issues",
|
||||||
"source": "https://github.com/theofidry/cpu-core-counter/tree/1.1.0"
|
"source": "https://github.com/theofidry/cpu-core-counter/tree/1.2.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -2280,7 +2349,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-02-07T09:43:46+00:00"
|
"time": "2024-08-06T10:04:20+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "filp/whoops",
|
"name": "filp/whoops",
|
||||||
@@ -2466,17 +2535,58 @@
|
|||||||
"time": "2024-08-01T12:14:16+00:00"
|
"time": "2024-08-01T12:14:16+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/pint",
|
"name": "larapack/dd",
|
||||||
"version": "dev-main",
|
"version": "dev-master",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/pint.git",
|
"url": "https://github.com/larapack/dd.git",
|
||||||
"reference": "e24a6aa83b23c0b64ab3486d68fbc88ab266e03f"
|
"reference": "561b5111a13d0094b59b5c81b1572489485fb948"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/pint/zipball/e24a6aa83b23c0b64ab3486d68fbc88ab266e03f",
|
"url": "https://api.github.com/repos/larapack/dd/zipball/561b5111a13d0094b59b5c81b1572489485fb948",
|
||||||
"reference": "e24a6aa83b23c0b64ab3486d68fbc88ab266e03f",
|
"reference": "561b5111a13d0094b59b5c81b1572489485fb948",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"symfony/var-dumper": "*"
|
||||||
|
},
|
||||||
|
"default-branch": true,
|
||||||
|
"type": "package",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/helper.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Mark Topper",
|
||||||
|
"email": "hi@webman.io"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "`dd` is a helper method in Laravel. This package will add the `dd` to your application.",
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/larapack/dd/issues",
|
||||||
|
"source": "https://github.com/larapack/dd/tree/v1.1"
|
||||||
|
},
|
||||||
|
"time": "2016-12-15T09:34:34+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "laravel/pint",
|
||||||
|
"version": "v1.5.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/laravel/pint.git",
|
||||||
|
"reference": "e0a8cef58b74662f27355be9cdea0e726bbac362"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/laravel/pint/zipball/e0a8cef58b74662f27355be9cdea0e726bbac362",
|
||||||
|
"reference": "e0a8cef58b74662f27355be9cdea0e726bbac362",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -2484,18 +2594,17 @@
|
|||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"ext-tokenizer": "*",
|
"ext-tokenizer": "*",
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"php": "^8.1.0"
|
"php": "^8.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"friendsofphp/php-cs-fixer": "^3.61.1",
|
"friendsofphp/php-cs-fixer": "^3.14.4",
|
||||||
"illuminate/view": "^10.48.18",
|
"illuminate/view": "^9.51.0",
|
||||||
"larastan/larastan": "^2.9.8",
|
"laravel-zero/framework": "^9.2.0",
|
||||||
"laravel-zero/framework": "^10.4.0",
|
"mockery/mockery": "^1.5.1",
|
||||||
"mockery/mockery": "^1.6.12",
|
"nunomaduro/larastan": "^2.4.0",
|
||||||
"nunomaduro/termwind": "^1.15.1",
|
"nunomaduro/termwind": "^1.15.1",
|
||||||
"pestphp/pest": "^2.35.0"
|
"pestphp/pest": "^1.22.4"
|
||||||
},
|
},
|
||||||
"default-branch": true,
|
|
||||||
"bin": [
|
"bin": [
|
||||||
"builds/pint"
|
"builds/pint"
|
||||||
],
|
],
|
||||||
@@ -2530,7 +2639,7 @@
|
|||||||
"issues": "https://github.com/laravel/pint/issues",
|
"issues": "https://github.com/laravel/pint/issues",
|
||||||
"source": "https://github.com/laravel/pint"
|
"source": "https://github.com/laravel/pint"
|
||||||
},
|
},
|
||||||
"time": "2024-08-06T15:12:57+00:00"
|
"time": "2023-02-14T16:31:02+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mockery/mockery",
|
"name": "mockery/mockery",
|
||||||
@@ -2922,36 +3031,36 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pestphp/pest",
|
"name": "pestphp/pest",
|
||||||
"version": "v2.34.4",
|
"version": "v2.35.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/pestphp/pest.git",
|
"url": "https://github.com/pestphp/pest.git",
|
||||||
"reference": "6a1161ead830294ef8e21fab83c0bd118b0df7cc"
|
"reference": "b13acb630df52c06123588d321823c31fc685545"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/pestphp/pest/zipball/6a1161ead830294ef8e21fab83c0bd118b0df7cc",
|
"url": "https://api.github.com/repos/pestphp/pest/zipball/b13acb630df52c06123588d321823c31fc685545",
|
||||||
"reference": "6a1161ead830294ef8e21fab83c0bd118b0df7cc",
|
"reference": "b13acb630df52c06123588d321823c31fc685545",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"brianium/paratest": "^7.3.1",
|
"brianium/paratest": "^7.3.1",
|
||||||
"nunomaduro/collision": "^7.10.0|^8.1.1",
|
"nunomaduro/collision": "^7.10.0|^8.4.0",
|
||||||
"nunomaduro/termwind": "^1.15.1|^2.0.1",
|
"nunomaduro/termwind": "^1.15.1|^2.0.1",
|
||||||
"pestphp/pest-plugin": "^2.1.1",
|
"pestphp/pest-plugin": "^2.1.1",
|
||||||
"pestphp/pest-plugin-arch": "^2.7.0",
|
"pestphp/pest-plugin-arch": "^2.7.0",
|
||||||
"php": "^8.1.0",
|
"php": "^8.1.0",
|
||||||
"phpunit/phpunit": "^10.5.13"
|
"phpunit/phpunit": "^10.5.17"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"phpunit/phpunit": ">10.5.13",
|
"phpunit/phpunit": ">10.5.17",
|
||||||
"sebastian/exporter": "<5.1.0",
|
"sebastian/exporter": "<5.1.0",
|
||||||
"webmozart/assert": "<1.11.0"
|
"webmozart/assert": "<1.11.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"pestphp/pest-dev-tools": "^2.16.0",
|
"pestphp/pest-dev-tools": "^2.16.0",
|
||||||
"pestphp/pest-plugin-type-coverage": "^2.8.1",
|
"pestphp/pest-plugin-type-coverage": "^2.8.5",
|
||||||
"symfony/process": "^6.4.0|^7.0.4"
|
"symfony/process": "^6.4.0|^7.1.3"
|
||||||
},
|
},
|
||||||
"bin": [
|
"bin": [
|
||||||
"bin/pest"
|
"bin/pest"
|
||||||
@@ -3014,7 +3123,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/pestphp/pest/issues",
|
"issues": "https://github.com/pestphp/pest/issues",
|
||||||
"source": "https://github.com/pestphp/pest/tree/v2.34.4"
|
"source": "https://github.com/pestphp/pest/tree/v2.35.1"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -3026,7 +3135,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-03-14T19:44:18+00:00"
|
"time": "2024-08-20T21:41:50+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pestphp/pest-plugin",
|
"name": "pestphp/pest-plugin",
|
||||||
@@ -3349,12 +3458,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
|
||||||
"reference": "aa53f8d4374d1f5bd3fc598548d6272cb5d9bf39"
|
"reference": "60741fe3871f40e44ca10a28ce85d08b7ed841cd"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/aa53f8d4374d1f5bd3fc598548d6272cb5d9bf39",
|
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/60741fe3871f40e44ca10a28ce85d08b7ed841cd",
|
||||||
"reference": "aa53f8d4374d1f5bd3fc598548d6272cb5d9bf39",
|
"reference": "60741fe3871f40e44ca10a28ce85d08b7ed841cd",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3406,7 +3515,7 @@
|
|||||||
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
|
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
|
||||||
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.x"
|
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.x"
|
||||||
},
|
},
|
||||||
"time": "2024-05-21T06:14:15+00:00"
|
"time": "2024-08-14T20:00:37+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpdocumentor/type-resolver",
|
"name": "phpdocumentor/type-resolver",
|
||||||
@@ -3469,16 +3578,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpdoc-parser",
|
"name": "phpstan/phpdoc-parser",
|
||||||
"version": "1.29.1",
|
"version": "1.30.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||||
"reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4"
|
"reference": "5ceb0e384997db59f38774bf79c2a6134252c08f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fcaefacf2d5c417e928405b71b400d4ce10daaf4",
|
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/5ceb0e384997db59f38774bf79c2a6134252c08f",
|
||||||
"reference": "fcaefacf2d5c417e928405b71b400d4ce10daaf4",
|
"reference": "5ceb0e384997db59f38774bf79c2a6134252c08f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3510,9 +3619,9 @@
|
|||||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.29.1"
|
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.0"
|
||||||
},
|
},
|
||||||
"time": "2024-05-31T08:52:43+00:00"
|
"time": "2024-08-29T09:54:52+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
@@ -3520,28 +3629,28 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
|
||||||
"reference": "09d5f55e54c20f2353a790d09772db3ad577b9ac"
|
"reference": "7e308268858ed6baedc8704a304727d20bc07c77"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/09d5f55e54c20f2353a790d09772db3ad577b9ac",
|
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77",
|
||||||
"reference": "09d5f55e54c20f2353a790d09772db3ad577b9ac",
|
"reference": "7e308268858ed6baedc8704a304727d20bc07c77",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"ext-dom": "*",
|
"ext-dom": "*",
|
||||||
"ext-libxml": "*",
|
"ext-libxml": "*",
|
||||||
"ext-xmlwriter": "*",
|
"ext-xmlwriter": "*",
|
||||||
"nikic/php-parser": "^4.18 || ^5.0",
|
"nikic/php-parser": "^4.19.1 || ^5.1.0",
|
||||||
"php": ">=8.1",
|
"php": ">=8.1",
|
||||||
"phpunit/php-file-iterator": "^4.0",
|
"phpunit/php-file-iterator": "^4.1.0",
|
||||||
"phpunit/php-text-template": "^3.0",
|
"phpunit/php-text-template": "^3.0.1",
|
||||||
"sebastian/code-unit-reverse-lookup": "^3.0",
|
"sebastian/code-unit-reverse-lookup": "^3.0.0",
|
||||||
"sebastian/complexity": "^3.0",
|
"sebastian/complexity": "^3.2.0",
|
||||||
"sebastian/environment": "^6.0",
|
"sebastian/environment": "^6.1.0",
|
||||||
"sebastian/lines-of-code": "^2.0",
|
"sebastian/lines-of-code": "^2.0.2",
|
||||||
"sebastian/version": "^4.0",
|
"sebastian/version": "^4.0.1",
|
||||||
"theseer/tokenizer": "^1.2.0"
|
"theseer/tokenizer": "^1.2.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^10.1"
|
"phpunit/phpunit": "^10.1"
|
||||||
@@ -3582,7 +3691,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1"
|
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -3590,7 +3699,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-07-17T05:15:22+00:00"
|
"time": "2024-08-22T04:31:57+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-file-iterator",
|
"name": "phpunit/php-file-iterator",
|
||||||
@@ -3839,16 +3948,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "10.5.13",
|
"version": "10.5.17",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "20a63fc1c6db29b15da3bd02d4b6cf59900088a7"
|
"reference": "c1f736a473d21957ead7e94fcc029f571895abf5"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/20a63fc1c6db29b15da3bd02d4b6cf59900088a7",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c1f736a473d21957ead7e94fcc029f571895abf5",
|
||||||
"reference": "20a63fc1c6db29b15da3bd02d4b6cf59900088a7",
|
"reference": "c1f736a473d21957ead7e94fcc029f571895abf5",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3920,7 +4029,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.13"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.17"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -3936,7 +4045,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-03-12T15:37:41+00:00"
|
"time": "2024-04-05T04:39:01+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/log",
|
"name": "psr/log",
|
||||||
@@ -3944,12 +4053,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/php-fig/log.git",
|
"url": "https://github.com/php-fig/log.git",
|
||||||
"reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001"
|
"reference": "79dff0b268932c640297f5208d6298f71855c03e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001",
|
"url": "https://api.github.com/repos/php-fig/log/zipball/79dff0b268932c640297f5208d6298f71855c03e",
|
||||||
"reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001",
|
"reference": "79dff0b268932c640297f5208d6298f71855c03e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3985,9 +4094,9 @@
|
|||||||
"psr-3"
|
"psr-3"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/php-fig/log/tree/3.0.0"
|
"source": "https://github.com/php-fig/log/tree/3.0.1"
|
||||||
},
|
},
|
||||||
"time": "2021-07-14T16:46:02+00:00"
|
"time": "2024-08-21T13:31:24+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/cli-parser",
|
"name": "sebastian/cli-parser",
|
||||||
@@ -4918,12 +5027,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/console.git",
|
"url": "https://github.com/symfony/console.git",
|
||||||
"reference": "2204ca36f39ffe9bc0856123d45fd6cea52a2681"
|
"reference": "ee7ee22b1dabcff731b7d79d3633c96251ad8404"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/console/zipball/2204ca36f39ffe9bc0856123d45fd6cea52a2681",
|
"url": "https://api.github.com/repos/symfony/console/zipball/ee7ee22b1dabcff731b7d79d3633c96251ad8404",
|
||||||
"reference": "2204ca36f39ffe9bc0856123d45fd6cea52a2681",
|
"reference": "ee7ee22b1dabcff731b7d79d3633c96251ad8404",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -5003,75 +5112,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-08-12T10:26:02+00:00"
|
"time": "2024-08-30T15:40:32+00:00"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "symfony/deprecation-contracts",
|
|
||||||
"version": "dev-main",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/symfony/deprecation-contracts.git",
|
|
||||||
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
|
||||||
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=8.1"
|
|
||||||
},
|
|
||||||
"default-branch": true,
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-main": "3.5-dev"
|
|
||||||
},
|
|
||||||
"thanks": {
|
|
||||||
"name": "symfony/contracts",
|
|
||||||
"url": "https://github.com/symfony/contracts"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"files": [
|
|
||||||
"function.php"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Nicolas Grekas",
|
|
||||||
"email": "p@tchwork.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Symfony Community",
|
|
||||||
"homepage": "https://symfony.com/contributors"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "A generic function and convention to trigger deprecation notices",
|
|
||||||
"homepage": "https://symfony.com",
|
|
||||||
"support": {
|
|
||||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0"
|
|
||||||
},
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"url": "https://symfony.com/sponsor",
|
|
||||||
"type": "custom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://github.com/fabpot",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
|
||||||
"type": "tidelift"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"time": "2024-04-18T09:32:20+00:00"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-ctype",
|
"name": "symfony/polyfill-ctype",
|
||||||
@@ -5464,6 +5505,89 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-08-12T10:26:02+00:00"
|
"time": "2024-08-12T10:26:02+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/var-dumper",
|
||||||
|
"version": "7.2.x-dev",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/var-dumper.git",
|
||||||
|
"reference": "f74e6c4199357f1b566a67bbe834ebd7de658839"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/f74e6c4199357f1b566a67bbe834ebd7de658839",
|
||||||
|
"reference": "f74e6c4199357f1b566a67bbe834ebd7de658839",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.2",
|
||||||
|
"symfony/polyfill-mbstring": "~1.0"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"symfony/console": "<6.4"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"ext-iconv": "*",
|
||||||
|
"symfony/console": "^6.4|^7.0",
|
||||||
|
"symfony/http-kernel": "^6.4|^7.0",
|
||||||
|
"symfony/process": "^6.4|^7.0",
|
||||||
|
"symfony/uid": "^6.4|^7.0",
|
||||||
|
"twig/twig": "^3.12|^4.0"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"Resources/bin/var-dump-server"
|
||||||
|
],
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"Resources/functions/dump.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Component\\VarDumper\\": ""
|
||||||
|
},
|
||||||
|
"exclude-from-classmap": [
|
||||||
|
"/Tests/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Provides mechanisms for walking through any arbitrary PHP variable",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"debug",
|
||||||
|
"dump"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/var-dumper/tree/7.2"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-09-02T15:30:47+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "ta-tikoma/phpunit-architecture-test",
|
"name": "ta-tikoma/phpunit-architecture-test",
|
||||||
"version": "0.8.4",
|
"version": "0.8.4",
|
||||||
@@ -5635,7 +5759,7 @@
|
|||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": {
|
"stability-flags": {
|
||||||
"laravel/pint": 20
|
"larapack/dd": 20
|
||||||
},
|
},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
|
|||||||
+6
-14
@@ -3,34 +3,26 @@
|
|||||||
return [
|
return [
|
||||||
/*
|
/*
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
* formatting
|
* Formatting
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
*
|
|
||||||
* the formatting of shopping cart values
|
|
||||||
*/
|
*/
|
||||||
'format_numbers' => env('SHOPPING_FORMAT_VALUES', false),
|
'format_numbers' => env('LARAVEL_CART_FORMAT_VALUES', false),
|
||||||
|
|
||||||
'decimals' => env('SHOPPING_DECIMALS', 0),
|
'decimals' => env('LARAVEL_CART_DECIMALS', 0),
|
||||||
|
|
||||||
'dec_point' => env('SHOPPING_DEC_POINT', '.'),
|
'round_mode' => env('LARAVEL_CART_ROUND_MODE', 'down'),
|
||||||
|
|
||||||
'thousands_sep' => env('SHOPPING_THOUSANDS_SEP', ','),
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
* persistence
|
* Persistence
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
*
|
|
||||||
* the configuration for persisting cart
|
|
||||||
*/
|
*/
|
||||||
'storage' => null,
|
'storage' => null,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
* events
|
* Events
|
||||||
* ---------------------------------------------------------------
|
* ---------------------------------------------------------------
|
||||||
*
|
|
||||||
* the configuration for cart events
|
|
||||||
*/
|
*/
|
||||||
'events' => null,
|
'events' => null,
|
||||||
];
|
];
|
||||||
@@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
|
||||||
bootstrap="vendor/autoload.php"
|
bootstrap="vendor/autoload.php"
|
||||||
colors="true"
|
colors="true"
|
||||||
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
|
||||||
>
|
>
|
||||||
<testsuites>
|
<source>
|
||||||
<testsuite name="Unit">
|
|
||||||
<directory suffix="Test.php">./tests/Unit</directory>
|
|
||||||
</testsuite>
|
|
||||||
</testsuites>
|
|
||||||
<source>
|
|
||||||
<include>
|
<include>
|
||||||
<directory suffix=".php">./src</directory>
|
<directory suffix=".php">./src</directory>
|
||||||
</include>
|
</include>
|
||||||
</source>
|
</source>
|
||||||
|
<testsuites>
|
||||||
|
<testsuite name="Laravel Cart Test Suite">
|
||||||
|
<directory>tests</directory>
|
||||||
|
</testsuite>
|
||||||
|
</testsuites>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"preset": "laravel",
|
"preset": "laravel",
|
||||||
"rules": {
|
"rules": {
|
||||||
"concat_space": {
|
"concat_space": {
|
||||||
"spacing": "one"
|
"spacing": "one"
|
||||||
},
|
},
|
||||||
"class_attributes_separation": false,
|
"class_attributes_separation": false,
|
||||||
"ordered_imports": {
|
"ordered_imports": {
|
||||||
"sort_algorithm": "length"
|
"sort_algorithm": "length"
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+158
-159
@@ -10,59 +10,22 @@
|
|||||||
|
|
||||||
class Cart
|
class Cart
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* the item storage
|
|
||||||
*/
|
|
||||||
protected $session;
|
protected $session;
|
||||||
|
|
||||||
/**
|
|
||||||
* the event dispatcher
|
|
||||||
*/
|
|
||||||
protected $events;
|
protected $events;
|
||||||
|
|
||||||
/**
|
|
||||||
* the cart session key
|
|
||||||
*/
|
|
||||||
protected $instanceName;
|
protected $instanceName;
|
||||||
|
|
||||||
/**
|
|
||||||
* the session key use for the cart
|
|
||||||
*/
|
|
||||||
protected $sessionKey;
|
protected $sessionKey;
|
||||||
|
|
||||||
/**
|
|
||||||
* the session key use to persist cart items
|
|
||||||
*/
|
|
||||||
protected $sessionKeyCartItems;
|
protected $sessionKeyCartItems;
|
||||||
|
|
||||||
/**
|
|
||||||
* the session key use to persist cart conditions
|
|
||||||
*/
|
|
||||||
protected $sessionKeyCartConditions;
|
protected $sessionKeyCartConditions;
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration to pass to ItemCollection
|
|
||||||
*/
|
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/**
|
|
||||||
* This holds the currently added item id in cart for association
|
|
||||||
*/
|
|
||||||
protected $currentItemId;
|
protected $currentItemId;
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of decimals to use when formatting prices
|
|
||||||
*/
|
|
||||||
protected $decimals;
|
protected $decimals;
|
||||||
|
|
||||||
/**
|
|
||||||
* The decimal point character
|
|
||||||
*/
|
|
||||||
protected $decPoint;
|
protected $decPoint;
|
||||||
|
|
||||||
/**
|
|
||||||
* our object constructor
|
|
||||||
*/
|
|
||||||
public function __construct($session, $events, $instanceName, $session_key, $config)
|
public function __construct($session, $events, $instanceName, $session_key, $config)
|
||||||
{
|
{
|
||||||
$this->events = $events;
|
$this->events = $events;
|
||||||
@@ -73,6 +36,7 @@ public function __construct($session, $events, $instanceName, $session_key, $con
|
|||||||
$this->sessionKeyCartConditions = $this->sessionKey . '_cart_conditions';
|
$this->sessionKeyCartConditions = $this->sessionKey . '_cart_conditions';
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->currentItemId = null;
|
$this->currentItemId = null;
|
||||||
|
|
||||||
$this->fireEvent('created');
|
$this->fireEvent('created');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,20 +73,16 @@ public function getInstanceName()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* get an item on a cart by item ID
|
* get an item on a cart by item ID
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function get($itemId)
|
public function get($itemId): ?ItemCollection
|
||||||
{
|
{
|
||||||
return $this->getContent()->get($itemId);
|
return $this->getContent()->get($itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if an item exists by item ID
|
* check if we have this item in the cart by item ID
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function has($itemId)
|
public function has($itemId): bool
|
||||||
{
|
{
|
||||||
return $this->getContent()->has($itemId);
|
return $this->getContent()->has($itemId);
|
||||||
}
|
}
|
||||||
@@ -131,29 +91,28 @@ public function has($itemId)
|
|||||||
* add item to the cart, it can be an array or multi dimensional array
|
* add item to the cart, it can be an array or multi dimensional array
|
||||||
*
|
*
|
||||||
* @param string|array $id
|
* @param string|array $id
|
||||||
* @param string $name
|
|
||||||
* @param float $price
|
|
||||||
* @param int $quantity
|
|
||||||
* @param array $attributes
|
|
||||||
* @param CartCondition|array $conditions
|
|
||||||
* @param string $associatedModel
|
|
||||||
* @return $this
|
* @return $this
|
||||||
*
|
*
|
||||||
* @throws InvalidItemException
|
* @throws InvalidItemException
|
||||||
*/
|
*/
|
||||||
public function add($id, $name = null, $price = null, $quantity = null, $attributes = [], $conditions = [], $associatedModel = null)
|
public function add(
|
||||||
{
|
string|int|array $id,
|
||||||
// if the first argument is an array,
|
?string $name = null,
|
||||||
// we will need to call add again
|
?float $price = null,
|
||||||
|
int|float|null $quantity = null,
|
||||||
|
array $attributes = [],
|
||||||
|
array|CartCondition $conditions = [],
|
||||||
|
?string $associatedModel = null
|
||||||
|
): self {
|
||||||
|
// check if we are adding an array of items
|
||||||
if (is_array($id)) {
|
if (is_array($id)) {
|
||||||
// the first argument is an array, now we will need to check if it is a multi dimensional
|
// check if we are adding a multi dimensional array
|
||||||
// array, if so, we will iterate through each item and call add again
|
|
||||||
if (Helpers::isMultiArray($id)) {
|
if (Helpers::isMultiArray($id)) {
|
||||||
foreach ($id as $item) {
|
foreach ($id as $item) {
|
||||||
$this->add(
|
$this->add(
|
||||||
$item['id'],
|
$item['id'],
|
||||||
$item['name'],
|
$item['name'],
|
||||||
$item['price'],
|
isset($item['price']) ? $item['price'] : null,
|
||||||
$item['quantity'],
|
$item['quantity'],
|
||||||
Helpers::issetAndHasValueOrAssignDefault($item['attributes'], []),
|
Helpers::issetAndHasValueOrAssignDefault($item['attributes'], []),
|
||||||
Helpers::issetAndHasValueOrAssignDefault($item['conditions'], []),
|
Helpers::issetAndHasValueOrAssignDefault($item['conditions'], []),
|
||||||
@@ -164,7 +123,7 @@ public function add($id, $name = null, $price = null, $quantity = null, $attribu
|
|||||||
$this->add(
|
$this->add(
|
||||||
$id['id'],
|
$id['id'],
|
||||||
$id['name'],
|
$id['name'],
|
||||||
$id['price'],
|
isset($id['price']) ? $id['price'] : null,
|
||||||
$id['quantity'],
|
$id['quantity'],
|
||||||
Helpers::issetAndHasValueOrAssignDefault($id['attributes'], []),
|
Helpers::issetAndHasValueOrAssignDefault($id['attributes'], []),
|
||||||
Helpers::issetAndHasValueOrAssignDefault($id['conditions'], []),
|
Helpers::issetAndHasValueOrAssignDefault($id['conditions'], []),
|
||||||
@@ -175,6 +134,7 @@ public function add($id, $name = null, $price = null, $quantity = null, $attribu
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if we are here, we are adding a single item
|
||||||
$data = [
|
$data = [
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
@@ -191,16 +151,11 @@ public function add($id, $name = null, $price = null, $quantity = null, $attribu
|
|||||||
// validate data
|
// validate data
|
||||||
$item = $this->validate($data);
|
$item = $this->validate($data);
|
||||||
|
|
||||||
// get the cart
|
|
||||||
$cart = $this->getContent();
|
|
||||||
|
|
||||||
// if the item is already in the cart we will just update it
|
// if the item is already in the cart we will just update it
|
||||||
if ($cart->has($id)) {
|
if ($this->get($id)) {
|
||||||
|
|
||||||
$this->update($id, $item);
|
$this->update($id, $item);
|
||||||
} else {
|
} else {
|
||||||
|
$this->addItem($id, $item);
|
||||||
$this->addRow($id, $item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->currentItemId = $id;
|
$this->currentItemId = $id;
|
||||||
@@ -209,15 +164,9 @@ public function add($id, $name = null, $price = null, $quantity = null, $attribu
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update a cart
|
* Update a cart item with whatever data is passed in
|
||||||
*
|
|
||||||
* @param array $data
|
|
||||||
*
|
|
||||||
* the $data will be an associative array, you don't need to pass all the data, only the key value
|
|
||||||
* of the item you want to update on it
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function update($id, $data)
|
public function update(int|string $id, array $data): bool
|
||||||
{
|
{
|
||||||
if ($this->fireEvent('updating', $data) === false) {
|
if ($this->fireEvent('updating', $data) === false) {
|
||||||
return false;
|
return false;
|
||||||
@@ -225,21 +174,13 @@ public function update($id, $data)
|
|||||||
|
|
||||||
$cart = $this->getContent();
|
$cart = $this->getContent();
|
||||||
|
|
||||||
$item = $cart->pull($id);
|
$item = $cart->get($id);
|
||||||
|
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
// if the key is currently "quantity" we will need to check if an arithmetic
|
|
||||||
// symbol is present so we can decide if the update of quantity is being added
|
|
||||||
// or being reduced.
|
|
||||||
if ($key == 'quantity') {
|
if ($key == 'quantity') {
|
||||||
// we will check if quantity value provided is array,
|
|
||||||
// if it is, we will need to check if a key "relative" is set
|
|
||||||
// and we will evaluate its value if true or false,
|
|
||||||
// this tells us how to treat the quantity value if it should be updated
|
|
||||||
// relatively to its current quantity value or just totally replace the value
|
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
if (isset($value['relative'])) {
|
if (isset($value['relative'])) {
|
||||||
if ((bool) $value['relative']) {
|
if (isset($value['relative']) && $value['relative'] === true) {
|
||||||
$item = $this->updateQuantityRelative($item, $key, $value['value']);
|
$item = $this->updateQuantityRelative($item, $key, $value['value']);
|
||||||
} else {
|
} else {
|
||||||
$item = $this->updateQuantityNotRelative($item, $key, $value['value']);
|
$item = $this->updateQuantityNotRelative($item, $key, $value['value']);
|
||||||
@@ -255,6 +196,7 @@ public function update($id, $data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update the item in the cart
|
||||||
$cart->put($id, $item);
|
$cart->put($id, $item);
|
||||||
|
|
||||||
$this->save($cart);
|
$this->save($cart);
|
||||||
@@ -353,14 +295,14 @@ public function clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add a condition on the cart
|
* Adds a condition to the cart
|
||||||
*
|
*/
|
||||||
* @param CartCondition|array $condition
|
/**
|
||||||
* @return $this
|
* Adds a condition to the cart
|
||||||
*
|
*
|
||||||
* @throws InvalidConditionException
|
* @throws InvalidConditionException
|
||||||
*/
|
*/
|
||||||
public function condition($condition)
|
public function condition(array|CartCondition $condition): self
|
||||||
{
|
{
|
||||||
if (is_array($condition)) {
|
if (is_array($condition)) {
|
||||||
foreach ($condition as $c) {
|
foreach ($condition as $c) {
|
||||||
@@ -396,11 +338,29 @@ public function condition($condition)
|
|||||||
/**
|
/**
|
||||||
* get conditions applied on the cart
|
* get conditions applied on the cart
|
||||||
*
|
*
|
||||||
* @return CartConditionCollection
|
* @param bool $active - If true, only conditions actually applied on the cart are returned
|
||||||
*/
|
*/
|
||||||
public function getConditions()
|
public function getConditions(bool $array = false, bool $active = false): CartConditionCollection|array
|
||||||
{
|
{
|
||||||
return new CartConditionCollection($this->session->get($this->sessionKeyCartConditions));
|
$conditions = new CartConditionCollection(
|
||||||
|
$this->session->get($this->sessionKeyCartConditions)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($active) {
|
||||||
|
return $conditions->filter(function (CartCondition $condition) {
|
||||||
|
$amount = $condition->getTarget() == 'subtotal' ? $this->getSubTotal(false) : $this->getTotal();
|
||||||
|
|
||||||
|
return $condition->getMinimum() === null || $condition->getMinimum() <= $amount;
|
||||||
|
})->filter(function (CartCondition $condition) {
|
||||||
|
$amount = $condition->getTarget() == 'subtotal' ? $this->getSubTotal(false) : $this->getTotal();
|
||||||
|
|
||||||
|
return $condition->getMaximum() === null || $condition->getMaximum() >= $amount;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return $array ? $conditions->map(function (CartCondition $condition) {
|
||||||
|
return $condition->toArray();
|
||||||
|
})->toArray() : $conditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -429,12 +389,8 @@ public function getConditionsByType($type)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all the condition with the $type specified
|
* Remove all the condition with the $type specified
|
||||||
* Please Note that this will only remove condition added on cart bases, not those conditions added
|
|
||||||
* specifically on an per item bases
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*/
|
*/
|
||||||
public function removeConditionsByType($type)
|
public function removeConditionsByType(string $type)
|
||||||
{
|
{
|
||||||
$this->getConditionsByType($type)->each(function ($condition) {
|
$this->getConditionsByType($type)->each(function ($condition) {
|
||||||
$this->removeCartCondition($condition->getName());
|
$this->removeCartCondition($condition->getName());
|
||||||
@@ -442,12 +398,7 @@ public function removeConditionsByType($type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* removes a condition on a cart by condition name,
|
* Remove a condition from the cart
|
||||||
* this can only remove conditions that are added on cart bases not conditions that are added on an item/product.
|
|
||||||
* If you wish to remove a condition that has been added for a specific item/product, you may
|
|
||||||
* use the removeItemCondition(itemId, conditionName) method instead.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function removeCartCondition($conditionName)
|
public function removeCartCondition($conditionName)
|
||||||
{
|
{
|
||||||
@@ -455,6 +406,9 @@ public function removeCartCondition($conditionName)
|
|||||||
|
|
||||||
$conditions->pull($conditionName);
|
$conditions->pull($conditionName);
|
||||||
|
|
||||||
|
// reset indexes
|
||||||
|
$conditions = $conditions->values();
|
||||||
|
|
||||||
$this->saveConditions($conditions);
|
$this->saveConditions($conditions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,6 +461,9 @@ public function removeItemCondition($itemId, $conditionName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset indexes
|
||||||
|
$item['conditions'] = array_values($item['conditions']);
|
||||||
|
|
||||||
$this->update($itemId, [
|
$this->update($itemId, [
|
||||||
'conditions' => $item['conditions'],
|
'conditions' => $item['conditions'],
|
||||||
]);
|
]);
|
||||||
@@ -533,13 +490,9 @@ public function clearItemConditions($itemId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clears all conditions on a cart,
|
* Clear cart conditions (this does not clear item conditions)
|
||||||
* this does not remove conditions that has been added specifically to an item/product.
|
|
||||||
* If you wish to remove a specific condition to a product, you may use the method: removeItemCondition($itemId, $conditionName)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function clearCartConditions()
|
public function clearCartConditions(): void
|
||||||
{
|
{
|
||||||
$this->session->put(
|
$this->session->put(
|
||||||
$this->sessionKeyCartConditions,
|
$this->sessionKeyCartConditions,
|
||||||
@@ -547,6 +500,20 @@ public function clearCartConditions()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear all conditions from all items and the cart
|
||||||
|
*/
|
||||||
|
public function clearAllConditions(): void
|
||||||
|
{
|
||||||
|
$cart = $this->getContent();
|
||||||
|
|
||||||
|
$cart->each(function ($item) {
|
||||||
|
$this->clearItemConditions($item->id);
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->clearCartConditions();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get cart sub total without conditions
|
* get cart sub total without conditions
|
||||||
*
|
*
|
||||||
@@ -568,81 +535,104 @@ public function getSubTotalWithoutConditions($formatted = true)
|
|||||||
* get cart sub total
|
* get cart sub total
|
||||||
*
|
*
|
||||||
* @param bool $formatted
|
* @param bool $formatted
|
||||||
* @return float
|
|
||||||
*/
|
*/
|
||||||
public function getSubTotal($formatted = true)
|
public function getSubTotal($formatted = true): int|float|string
|
||||||
{
|
{
|
||||||
$cart = $this->getContent();
|
$subTotal = 0.00;
|
||||||
|
// add all the items together with conditions applied
|
||||||
$sum = $cart->sum(function (ItemCollection $item) {
|
$subTotalSum = $this->getContent()->sum(function (ItemCollection $item) {
|
||||||
return $item->getPriceSumWithConditions(false);
|
return $item->getPriceSumWithConditions(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
// get the conditions that are meant to be applied
|
// get the conditions that are meant to be applied
|
||||||
// on the subtotal and apply it here before returning the subtotal
|
// on the subtotal and apply it here before returning the subtotal
|
||||||
$conditions = $this
|
$conditionsForSubtotal = $this->getConditions()
|
||||||
->getConditions()
|
->filter(function (CartCondition $condition) {
|
||||||
->filter(function (CartCondition $cond) {
|
return $condition->getTarget() === 'subtotal';
|
||||||
return $cond->getTarget() === 'subtotal';
|
})
|
||||||
|
->filter(function (CartCondition $condition) use ($subTotalSum) {
|
||||||
|
return $condition->getMinimum() === null || $condition->getMinimum() <= $subTotalSum;
|
||||||
|
})
|
||||||
|
->filter(function (CartCondition $condition) use ($subTotalSum) {
|
||||||
|
return $condition->getMaximum() === null || $condition->getMaximum() >= $subTotalSum;
|
||||||
|
})
|
||||||
|
->sortBy(function (CartCondition $condition) {
|
||||||
|
return $condition->getOrder();
|
||||||
});
|
});
|
||||||
|
|
||||||
// if there is no conditions, lets just return the sum
|
if ($conditionsForSubtotal->isEmpty()) {
|
||||||
if (! $conditions->count()) {
|
return Helpers::formatValue($subTotalSum, $formatted, $this->config);
|
||||||
return Helpers::formatValue($sum, $formatted, $this->config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// there are conditions, lets apply it
|
$index = 0;
|
||||||
$newTotal = 0.00;
|
|
||||||
$process = 0;
|
|
||||||
|
|
||||||
$conditions->each(function (CartCondition $cond) use ($sum, &$newTotal, &$process) {
|
$conditionsForSubtotal->each(function (CartCondition $condition) use ($subTotalSum, &$subTotal, &$index) {
|
||||||
|
$toBeCalculated = $index > 0 ? $subTotal : $subTotalSum;
|
||||||
|
|
||||||
// if this is the first iteration, the toBeCalculated
|
$subTotal = $condition->applyCondition($toBeCalculated);
|
||||||
// should be the sum as initial point of value.
|
|
||||||
$toBeCalculated = ($process > 0) ? $newTotal : $sum;
|
|
||||||
|
|
||||||
$newTotal = $cond->applyCondition($toBeCalculated);
|
$index++;
|
||||||
|
|
||||||
$process++;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return Helpers::formatValue((float) $newTotal, $formatted, $this->config);
|
return Helpers::formatValue($subTotal, $formatted, $this->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the new total in which conditions are already applied
|
* Get the total of the cart with conditions applied
|
||||||
*
|
|
||||||
* @return float
|
|
||||||
*/
|
*/
|
||||||
public function getTotal()
|
public function getTotal(): int|float
|
||||||
{
|
{
|
||||||
|
$total = 0.00;
|
||||||
$subTotal = $this->getSubTotal(false);
|
$subTotal = $this->getSubTotal(false);
|
||||||
|
|
||||||
$newTotal = 0.00;
|
$conditionsForTotal = $this->getConditions()
|
||||||
|
->filter(function (CartCondition $condition) {
|
||||||
$process = 0;
|
return $condition->getTarget() === 'total';
|
||||||
|
})
|
||||||
$conditions = $this
|
->filter(function (CartCondition $condition) use ($subTotal) {
|
||||||
->getConditions()
|
return $condition->getMinimum() === null || $condition->getMinimum() <= $subTotal;
|
||||||
->filter(function (CartCondition $cond) {
|
})
|
||||||
return $cond->getTarget() === 'total';
|
->filter(function (CartCondition $condition) use ($subTotal) {
|
||||||
|
return $condition->getMaximum() === null || $condition->getMaximum() >= $subTotal;
|
||||||
|
})
|
||||||
|
->sortBy(function (CartCondition $condition) {
|
||||||
|
return $condition->getOrder();
|
||||||
});
|
});
|
||||||
|
|
||||||
// if no conditions were added, just return the sub total
|
// if no conditions were added, just return the sub total
|
||||||
if (! $conditions->count()) {
|
if (! $conditionsForTotal->count()) {
|
||||||
return Helpers::formatValue($subTotal, $this->config['format_numbers'], $this->config);
|
return Helpers::formatValue($subTotal, $this->config['format_numbers'], $this->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
$conditions
|
$conditionsForTotal->each(function (CartCondition $condition) use ($subTotal, &$total) {
|
||||||
->each(function (CartCondition $cond) use ($subTotal, &$newTotal, &$process) {
|
$toBeCalculated = $total > 0 ? $total : $subTotal;
|
||||||
$toBeCalculated = ($process > 0) ? $newTotal : $subTotal;
|
|
||||||
|
|
||||||
$newTotal = $cond->applyCondition($toBeCalculated);
|
$total = $condition->applyCondition($toBeCalculated);
|
||||||
|
});
|
||||||
|
|
||||||
$process++;
|
return Helpers::formatValue($total, $this->config['format_numbers'], $this->config);
|
||||||
});
|
}
|
||||||
|
|
||||||
return Helpers::formatValue($newTotal, $this->config['format_numbers'], $this->config);
|
/**
|
||||||
|
* Get the calculated value for a condition by it's name
|
||||||
|
*/
|
||||||
|
public function getCalculatedValueForCondition(string $conditionName): int|float
|
||||||
|
{
|
||||||
|
$conditions = $this->getConditions();
|
||||||
|
|
||||||
|
$subTotal = $this->getSubTotalWithoutConditions(false);
|
||||||
|
|
||||||
|
foreach ($conditions as $condition) {
|
||||||
|
$conditionValue = $condition->getCalculatedValue($subTotal);
|
||||||
|
|
||||||
|
if ($condition->getName() === $conditionName) {
|
||||||
|
return $conditionValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$subTotal -= $conditionValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -698,15 +688,24 @@ protected function validate($item)
|
|||||||
{
|
{
|
||||||
$rules = [
|
$rules = [
|
||||||
'id' => 'required',
|
'id' => 'required',
|
||||||
'price' => 'required|numeric',
|
|
||||||
'quantity' => 'required|numeric|min:0.1',
|
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
|
'quantity' => 'required|numeric|min:0.1',
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = CartItemValidator::make($item, $rules);
|
$validator = CartItemValidator::make($item, $rules);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
throw new InvalidItemException($validator->messages()->first());
|
if ($validator->errors()->first('id') === 'validation.required') {
|
||||||
|
throw new InvalidItemException('The id field is required.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($validator->errors()->first('name') === 'validation.required') {
|
||||||
|
throw new InvalidItemException('The name field is required.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($validator->errors()->first('quantity') === 'validation.min.numeric') {
|
||||||
|
throw new InvalidItemException('The quantity must be at least 0.1.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
@@ -717,7 +716,7 @@ protected function validate($item)
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function addRow($id, $item)
|
protected function addItem($id, $item)
|
||||||
{
|
{
|
||||||
if ($this->fireEvent('adding', $item) === false) {
|
if ($this->fireEvent('adding', $item) === false) {
|
||||||
return false;
|
return false;
|
||||||
@@ -784,7 +783,7 @@ protected function itemHasConditions($item)
|
|||||||
protected function updateQuantityRelative($item, $key, $value)
|
protected function updateQuantityRelative($item, $key, $value)
|
||||||
{
|
{
|
||||||
if (preg_match('/\-/', $value) == 1) {
|
if (preg_match('/\-/', $value) == 1) {
|
||||||
$value = (int) str_replace('-', '', $value);
|
$value = (float) str_replace('-', '', $value);
|
||||||
|
|
||||||
// we will not allowed to reduced quantity to 0, so if the given value
|
// we will not allowed to reduced quantity to 0, so if the given value
|
||||||
// would result to item quantity of 0, we will not do it.
|
// would result to item quantity of 0, we will not do it.
|
||||||
@@ -792,9 +791,9 @@ protected function updateQuantityRelative($item, $key, $value)
|
|||||||
$item[$key] -= $value;
|
$item[$key] -= $value;
|
||||||
}
|
}
|
||||||
} elseif (preg_match('/\+/', $value) == 1) {
|
} elseif (preg_match('/\+/', $value) == 1) {
|
||||||
$item[$key] += (int) str_replace('+', '', $value);
|
$item[$key] += (float) str_replace('+', '', $value);
|
||||||
} else {
|
} else {
|
||||||
$item[$key] += (int) $value;
|
$item[$key] += (float) $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
@@ -807,7 +806,7 @@ protected function updateQuantityRelative($item, $key, $value)
|
|||||||
*/
|
*/
|
||||||
protected function updateQuantityNotRelative($item, $key, $value)
|
protected function updateQuantityNotRelative($item, $key, $value)
|
||||||
{
|
{
|
||||||
$item[$key] = (int) $value;
|
$item[$key] = (float) $value;
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,4 @@
|
|||||||
|
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class CartCollection extends Collection
|
class CartCollection extends Collection {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
+35
-9
@@ -8,15 +8,12 @@
|
|||||||
|
|
||||||
class CartCondition
|
class CartCondition
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $args;
|
private $args;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the parsed raw value of the condition
|
* the parsed raw value of the condition
|
||||||
*/
|
*/
|
||||||
public $parsedRawValue;
|
private $parsedRawValue = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $args (name, type, target, value)
|
* @param array $args (name, type, target, value)
|
||||||
@@ -65,6 +62,22 @@ public function getType()
|
|||||||
return $this->args['type'];
|
return $this->args['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the minimum value of this condition
|
||||||
|
*/
|
||||||
|
public function getMinimum(): int|float|null
|
||||||
|
{
|
||||||
|
return $this->args['minimum'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the maximum value of this condition
|
||||||
|
*/
|
||||||
|
public function getMaximum(): int|float|null
|
||||||
|
{
|
||||||
|
return $this->args['maximum'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the additional attributes of a condition
|
* get the additional attributes of a condition
|
||||||
*
|
*
|
||||||
@@ -77,14 +90,20 @@ public function getAttributes()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* the value of this the condition
|
* the value of this the condition
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function getValue()
|
public function getValue(): int|float|string
|
||||||
{
|
{
|
||||||
return $this->args['value'];
|
return $this->args['value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the value of this condition
|
||||||
|
*/
|
||||||
|
public function setValue($value): void
|
||||||
|
{
|
||||||
|
$this->args['value'] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the order to apply this condition. If no argument order is applied we return 0 as
|
* Set the order to apply this condition. If no argument order is applied we return 0 as
|
||||||
* indicator that no assignment has been made
|
* indicator that no assignment has been made
|
||||||
@@ -123,9 +142,11 @@ public function applyCondition($totalOrSubTotalOrPrice)
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getCalculatedValue($totalOrSubTotalOrPrice)
|
public function getCalculatedValue($totalOrSubTotalOrPrice = null): int|float
|
||||||
{
|
{
|
||||||
$this->apply($totalOrSubTotalOrPrice, $this->getValue());
|
if ($totalOrSubTotalOrPrice) {
|
||||||
|
$this->apply($totalOrSubTotalOrPrice, $this->getValue());
|
||||||
|
}
|
||||||
|
|
||||||
return $this->parsedRawValue;
|
return $this->parsedRawValue;
|
||||||
}
|
}
|
||||||
@@ -245,4 +266,9 @@ protected function validate($args)
|
|||||||
throw new InvalidConditionException($validator->messages()->first());
|
throw new InvalidConditionException($validator->messages()->first());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function toArray(): array
|
||||||
|
{
|
||||||
|
return $this->args;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,4 @@
|
|||||||
|
|
||||||
namespace Wearepixel\Cart\Exceptions;
|
namespace Wearepixel\Cart\Exceptions;
|
||||||
|
|
||||||
class UnknownModelException extends \Exception
|
class UnknownModelException extends \Exception {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
+25
-15
@@ -5,25 +5,30 @@
|
|||||||
class Helpers
|
class Helpers
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* normalize price
|
* Normalize prices
|
||||||
*
|
|
||||||
* @return float
|
|
||||||
*/
|
*/
|
||||||
public static function normalizePrice($price)
|
public static function normalizePrice($price): ?float
|
||||||
{
|
{
|
||||||
return (is_string($price)) ? floatval($price) : $price;
|
return (is_string($price)) ? floatval($price) : $price;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check if array is multi dimensional array
|
* Get the rounding mode
|
||||||
* This will only check the first element of the array if it is still an array
|
|
||||||
* to decide that it is a multi dimensional, if you want to check the array strictly
|
|
||||||
* with all on its element, flag the second argument as true
|
|
||||||
*
|
|
||||||
* @param bool $recursive
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public static function isMultiArray($array, $recursive = false)
|
public static function roundMode($config): int
|
||||||
|
{
|
||||||
|
if (isset($config['round_mode']) && $config['round_mode'] == 'up') {
|
||||||
|
return PHP_ROUND_HALF_UP;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PHP_ROUND_HALF_DOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if array is multi dimensional array
|
||||||
|
* This will only check if the first element of the array is an array
|
||||||
|
*/
|
||||||
|
public static function isMultiArray(array $array, bool $recursive = false): bool
|
||||||
{
|
{
|
||||||
if ($recursive) {
|
if ($recursive) {
|
||||||
return (count($array) == count($array, COUNT_RECURSIVE)) ? false : true;
|
return (count($array) == count($array, COUNT_RECURSIVE)) ? false : true;
|
||||||
@@ -35,8 +40,9 @@ public static function isMultiArray($array, $recursive = false)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,10 +62,14 @@ public static function issetAndHasValueOrAssignDefault(&$var, $default = false)
|
|||||||
|
|
||||||
public static function formatValue($value, $formatNumber, $config)
|
public static function formatValue($value, $formatNumber, $config)
|
||||||
{
|
{
|
||||||
|
if (! $value) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ($formatNumber || $config['format_numbers']) {
|
if ($formatNumber || $config['format_numbers']) {
|
||||||
return floatval(number_format($value, $config['decimals'], $config['dec_point'], $config['thousands_sep']));
|
return round($value, $config['decimals'], self::roundMode($config));
|
||||||
} else {
|
} else {
|
||||||
return $value;
|
return floatval($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'format_numbers' => true,
|
||||||
|
'decimals' => 2,
|
||||||
|
'dec_point' => '.',
|
||||||
|
'thousands_sep' => ',',
|
||||||
|
'use_cents' => false,
|
||||||
|
];
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'format_numbers' => false,
|
'format_numbers' => true,
|
||||||
'decimals' => 2,
|
'decimals' => 2,
|
||||||
'dec_point' => '.',
|
'round_mode' => 'up',
|
||||||
'thousands_sep' => ',',
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -27,43 +27,3 @@
|
|||||||
expect()->extend('toBeOne', function () {
|
expect()->extend('toBeOne', function () {
|
||||||
return $this->toBe(1);
|
return $this->toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Functions
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| While Pest is very powerful out-of-the-box, you may have some testing code specific to your
|
|
||||||
| project that you don't want to repeat in every file. Here you can also expose helpers as
|
|
||||||
| global functions to help you to reduce the number of lines of code in your test files.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
function fillCart()
|
|
||||||
{
|
|
||||||
$items = [
|
|
||||||
[
|
|
||||||
'id' => 456,
|
|
||||||
'name' => 'Sample Item 1',
|
|
||||||
'price' => 67.99,
|
|
||||||
'quantity' => 1,
|
|
||||||
'attributes' => [],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 568,
|
|
||||||
'name' => 'Sample Item 2',
|
|
||||||
'price' => 69.25,
|
|
||||||
'quantity' => 1,
|
|
||||||
'attributes' => [],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 856,
|
|
||||||
'name' => 'Sample Item 3',
|
|
||||||
'price' => 50.25,
|
|
||||||
'quantity' => 1,
|
|
||||||
'attributes' => [],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->cart->add($items);
|
|
||||||
}
|
|
||||||
|
|||||||
+1819
-825
File diff suppressed because it is too large
Load Diff
+271
-111
@@ -21,115 +21,299 @@
|
|||||||
Mockery::close();
|
Mockery::close();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('cart can add item', function () {
|
describe('cart', function () {
|
||||||
$this->cart->add(455, 'Sample Item', 100.99, 2, []);
|
test('can add an item', function () {
|
||||||
|
$this->cart->add(1, 'Sample Item', 100.99, 2, []);
|
||||||
|
|
||||||
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
||||||
expect($this->cart->getContent()->count())->toEqual(1, 'Cart content should be 1');
|
expect($this->cart->getContent()->count())->toEqual(1, 'Cart content should be 1');
|
||||||
expect($this->cart->getContent()->first()['id'])->toEqual(455, 'Item added has ID of 455 so first content ID should be 455');
|
expect($this->cart->getContent()->first()['id'])->toEqual(1, 'Item added has ID of 1 so first content ID should be 1');
|
||||||
expect($this->cart->getContent()->first()['price'])->toEqual(100.99, 'Item added has price of 100.99 so first content price should be 100.99');
|
expect($this->cart->getContent()->first()['price'])->toEqual(100.99, 'Item added has price of 100.99 so first content price should be 100.99');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('cart can add item with no price', function () {
|
test('can add an item in cents', function () {
|
||||||
$this->cart->add(455, 'Sample Item', 0, 2, []);
|
$this->cart->add(1, 'Sample Item', 10099, 2, []);
|
||||||
|
|
||||||
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
||||||
expect($this->cart->getContent()->count())->toEqual(1, 'Cart content should be 1');
|
expect($this->cart->getContent()->count())->toEqual(1, 'Cart content should be 1');
|
||||||
expect($this->cart->getContent()->first()['id'])->toEqual(455, 'Item added has ID of 455 so first content ID should be 455');
|
expect($this->cart->getContent()->first()['id'])->toEqual(1, 'Item added has ID of 1 so first content ID should be 1');
|
||||||
expect($this->cart->getTotal())->toEqual(0, 'Total should be 0');
|
expect($this->cart->getContent()->first()['price'])->toEqual(10099, 'Item added has price of 100.99 so first content price should be 100.99');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('cart can add items as array', function () {
|
test('can add an item with no price', function () {
|
||||||
$item = [
|
$this->cart->add(455, 'Sample Item', 0, 2, []);
|
||||||
'id' => 456,
|
|
||||||
'name' => 'Sample Item',
|
|
||||||
'price' => 67.99,
|
|
||||||
'quantity' => 4,
|
|
||||||
'attributes' => [],
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->cart->add($item);
|
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
||||||
|
expect($this->cart->getContent()->count())->toEqual(1, 'Cart content should be 1');
|
||||||
|
expect($this->cart->getContent()->first()['id'])->toEqual(455, 'Item added has ID of 455 so first content ID should be 455');
|
||||||
|
expect($this->cart->getTotal())->toEqual(0, 'Total should be 0');
|
||||||
|
});
|
||||||
|
|
||||||
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
test('can add an item an array with no price', function () {
|
||||||
expect($this->cart->getContent()->count())->toEqual(1, 'Cart should have 1 item on it');
|
$this->cart->add([
|
||||||
expect($this->cart->getContent()->first()['id'])->toEqual(456, 'The first content must have ID of 456');
|
'id' => 455,
|
||||||
expect($this->cart->getContent()->first()['name'])->toEqual('Sample Item', 'The first content must have name of "Sample Item"');
|
'name' => 'Sample Item',
|
||||||
});
|
'quantity' => 2,
|
||||||
|
]);
|
||||||
|
|
||||||
test('cart can add items with multidimensional array', function () {
|
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
||||||
$items = [
|
expect($this->cart->getContent()->count())->toEqual(1, 'Cart content should be 1');
|
||||||
[
|
expect($this->cart->getContent()->first()['id'])->toEqual(455, 'Item added has ID of 455 so first content ID should be 455');
|
||||||
|
expect($this->cart->getTotal())->toEqual(0, 'Total should be 0');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can add an item without attributes', function () {
|
||||||
|
$item = [
|
||||||
|
'id' => 1,
|
||||||
|
'name' => 'Pocket Shorts',
|
||||||
|
'price' => 67.99,
|
||||||
|
'quantity' => 2,
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->cart->add($item);
|
||||||
|
|
||||||
|
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
||||||
|
expect($this->cart->getContent()->count())->toEqual(1, 'Cart content should be 1');
|
||||||
|
expect($this->cart->getTotal())->toEqual(135.98, 'Cart total should be 135.98');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can add items as array', function () {
|
||||||
|
$item = [
|
||||||
'id' => 456,
|
'id' => 456,
|
||||||
'name' => 'Sample Item 1',
|
'name' => 'Sample Item',
|
||||||
'price' => 67.99,
|
'price' => 67.99,
|
||||||
'quantity' => 4,
|
'quantity' => 4,
|
||||||
'attributes' => [],
|
'attributes' => [],
|
||||||
],
|
];
|
||||||
[
|
|
||||||
'id' => 568,
|
$this->cart->add($item);
|
||||||
'name' => 'Sample Item 2',
|
|
||||||
'price' => 69.25,
|
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
||||||
|
expect($this->cart->getContent()->count())->toEqual(1, 'Cart should have 1 item on it');
|
||||||
|
expect($this->cart->getContent()->first()['id'])->toEqual(456, 'The first content must have ID of 456');
|
||||||
|
expect($this->cart->getContent()->first()['name'])->toEqual('Sample Item', 'The first content must have name of "Sample Item"');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can add multiple items with an array', function () {
|
||||||
|
$items = [
|
||||||
|
[
|
||||||
|
'id' => 1,
|
||||||
|
'name' => 'Half Button Open Collar',
|
||||||
|
'price' => 71.99,
|
||||||
|
'quantity' => 1,
|
||||||
|
'attributes' => [],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 2,
|
||||||
|
'name' => 'Oli Crew Neck',
|
||||||
|
'price' => 59.99,
|
||||||
|
'quantity' => 1,
|
||||||
|
'attributes' => [],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 3,
|
||||||
|
'name' => 'Denim Shorts',
|
||||||
|
'price' => 69.99,
|
||||||
|
'quantity' => 3,
|
||||||
|
'attributes' => [],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->cart->add($items);
|
||||||
|
|
||||||
|
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
||||||
|
expect($this->cart->getContent()->toArray())->toHaveCount(3, 'Cart should have 3 items');
|
||||||
|
expect($this->cart->getTotal())->toEqual(341.95, 'Cart should have a total of 341.95');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('cart item prices should be normalized when added to cart', function () {
|
||||||
|
// add a price in a string format should be converted to float
|
||||||
|
$this->cart->add(1, 'Book of Languages Item', '100.99', 2, []);
|
||||||
|
|
||||||
|
expect($this->cart->getContent()->first()['price'])->toBeFloat('Cart price should be a float');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can update a cart item with new attributes and it should be still instance of item attribute collection', function () {
|
||||||
|
$item = [
|
||||||
|
'id' => 1,
|
||||||
|
'name' => 'Leather Shows',
|
||||||
|
'price' => 67.99,
|
||||||
'quantity' => 4,
|
'quantity' => 4,
|
||||||
'attributes' => [],
|
'attributes' => [
|
||||||
],
|
'product_id' => '145',
|
||||||
[
|
'color' => 'red',
|
||||||
'id' => 856,
|
],
|
||||||
'name' => 'Sample Item 3',
|
];
|
||||||
'price' => 50.25,
|
|
||||||
'quantity' => 4,
|
|
||||||
'attributes' => [],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->cart->add($items);
|
$this->cart->add($item);
|
||||||
|
|
||||||
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
$item = $this->cart->get(1);
|
||||||
expect($this->cart->getContent()->toArray())->toHaveCount(3, 'Cart should have 3 items');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('cart can add item without attributes', function () {
|
expect($item->attributes)->toBeInstanceOf('Wearepixel\\Cart\\ItemAttributeCollection');
|
||||||
$item = [
|
|
||||||
'id' => 456,
|
|
||||||
'name' => 'Sample Item 1',
|
|
||||||
'price' => 67.99,
|
|
||||||
'quantity' => 4,
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->cart->add($item);
|
// now lets update the item with its new attributes
|
||||||
|
// when we get that item from cart, it should still be an instance of ItemAttributeCollection
|
||||||
|
$updatedItem = [
|
||||||
|
'attributes' => [
|
||||||
|
'product_id' => '145',
|
||||||
|
'color' => 'red',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
expect($this->cart->isEmpty())->toBeFalse('Cart should not be empty');
|
$this->cart->update(1, $updatedItem);
|
||||||
});
|
|
||||||
|
|
||||||
test('cart update with attribute then attributes should be still instance of item attribute collection', function () {
|
expect($item->attributes)->toBeInstanceOf('Wearepixel\\Cart\\ItemAttributeCollection');
|
||||||
$item = [
|
});
|
||||||
'id' => 456,
|
|
||||||
'name' => 'Sample Item 1',
|
|
||||||
'price' => 67.99,
|
|
||||||
'quantity' => 4,
|
|
||||||
'attributes' => [
|
|
||||||
'product_id' => '145',
|
|
||||||
'color' => 'red',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
$this->cart->add($item);
|
|
||||||
|
|
||||||
// lets get the attribute and prove first its an instance of
|
test('item orders are preserved by the order they are added', function () {
|
||||||
// ItemAttributeCollection
|
$items = [
|
||||||
$item = $this->cart->get(456);
|
[
|
||||||
|
'id' => 50,
|
||||||
|
'name' => 'Leather Shows',
|
||||||
|
'price' => 67.99,
|
||||||
|
'quantity' => 4,
|
||||||
|
'attributes' => [
|
||||||
|
'product_id' => '145',
|
||||||
|
'color' => 'red',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 2,
|
||||||
|
'name' => 'Oli Crew Neck',
|
||||||
|
'price' => 59.99,
|
||||||
|
'quantity' => 1,
|
||||||
|
'attributes' => [],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
expect($item->attributes)->toBeInstanceOf('Wearepixel\Cart\ItemAttributeCollection');
|
$this->cart->add($items);
|
||||||
|
|
||||||
// now lets update the item with its new attributes
|
$items = $this->cart->getContent();
|
||||||
// when we get that item from cart, it should still be an instance of ItemAttributeCollection
|
|
||||||
$updatedItem = [
|
|
||||||
'attributes' => [
|
|
||||||
'product_id' => '145',
|
|
||||||
'color' => 'red',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
$this->cart->update(456, $updatedItem);
|
|
||||||
|
|
||||||
expect($item->attributes)->toBeInstanceOf('Wearepixel\Cart\ItemAttributeCollection');
|
expect($items->toArray())->toHaveCount(2, 'Cart should have 2 items');
|
||||||
|
expect($items->first()->id)->toEqual(50, 'First item should have ID of 1');
|
||||||
|
expect($items->last()->id)->toEqual(2, 'Last item should have ID of 2');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('item orders are preserved by the order they are added even when items are updated', function () {
|
||||||
|
$items = [
|
||||||
|
[
|
||||||
|
'id' => 50,
|
||||||
|
'name' => 'Leather Shows',
|
||||||
|
'price' => 67.99,
|
||||||
|
'quantity' => 4,
|
||||||
|
'attributes' => [
|
||||||
|
'product_id' => '145',
|
||||||
|
'color' => 'red',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 2,
|
||||||
|
'name' => 'Oli Crew Neck',
|
||||||
|
'price' => 59.99,
|
||||||
|
'quantity' => 1,
|
||||||
|
'attributes' => [],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->cart->add($items);
|
||||||
|
|
||||||
|
$this->cart->update(50, ['name' => 'Updated Name']);
|
||||||
|
|
||||||
|
$items = $this->cart->getContent();
|
||||||
|
|
||||||
|
expect($items->toArray())->toHaveCount(2, 'Cart should have 2 items');
|
||||||
|
expect($items->first()->id)->toEqual(50, 'First item should have ID of 1');
|
||||||
|
expect($items->last()->id)->toEqual(2, 'Last item should have ID of 2');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can update existing items', function () {
|
||||||
|
$items = [
|
||||||
|
[
|
||||||
|
'id' => 1,
|
||||||
|
'name' => 'Magic The Gathering Card Pack',
|
||||||
|
'price' => 12.99,
|
||||||
|
'quantity' => 3,
|
||||||
|
'attributes' => [],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'id' => 2,
|
||||||
|
'name' => 'Magic The Gathering Card Case',
|
||||||
|
'price' => 39.99,
|
||||||
|
'quantity' => 1,
|
||||||
|
'attributes' => [],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->cart->add($items);
|
||||||
|
|
||||||
|
$item = $this->cart->get(1);
|
||||||
|
|
||||||
|
expect($item['name'])->toEqual('Magic The Gathering Card Pack', 'Item name should be "Magic The Gathering Card Pack"');
|
||||||
|
expect($item['price'])->toEqual(12.99, 'Item price should be "12.99"');
|
||||||
|
expect($item['quantity'])->toEqual(3, 'Item quantity should be 3');
|
||||||
|
|
||||||
|
// when cart's item quantity is updated, the subtotal should be updated as well
|
||||||
|
$this->cart->update(1, [
|
||||||
|
'name' => 'Magic The Gathering Card Packs',
|
||||||
|
'quantity' => 2,
|
||||||
|
'price' => 10.20,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$item = $this->cart->get(1);
|
||||||
|
|
||||||
|
expect($item['name'])->toEqual('Magic The Gathering Card Packs', 'Item name should be "Magic The Gathering Card Packs"');
|
||||||
|
expect($item['price'])->toEqual(10.20, 'Item price should be 10.20');
|
||||||
|
expect($item['quantity'])->toEqual(5, 'Item quantity should be 2');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('can update existing item quanties with decimals', function () {
|
||||||
|
$items = [
|
||||||
|
'id' => 1,
|
||||||
|
'name' => 'Fertilizer',
|
||||||
|
'price' => 30,
|
||||||
|
'quantity' => 7.8,
|
||||||
|
'attributes' => [
|
||||||
|
'unit' => 'kilogram',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->cart->add($items);
|
||||||
|
|
||||||
|
$item = $this->cart->get(1);
|
||||||
|
|
||||||
|
expect($item['quantity'])->toEqual(7.8, 'Item quantity should be 7.8');
|
||||||
|
|
||||||
|
// when cart's item quantity is updated, the subtotal should be updated as well
|
||||||
|
$this->cart->update(1, [
|
||||||
|
'quantity' => [
|
||||||
|
'relative' => true,
|
||||||
|
'value' => 2.1,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$item = $this->cart->get(1);
|
||||||
|
|
||||||
|
expect($item['quantity'])->toEqual(9.9, 'Item quantity should be 9.9');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should throw an exception when no quantity is provided', function () {
|
||||||
|
$this->expectException('Wearepixel\Cart\Exceptions\InvalidItemException');
|
||||||
|
$this->expectExceptionMessage('The quantity must be at least 0.1.');
|
||||||
|
$this->cart->add(455, 'Sample Item', 100.99, 0, []);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should throw an exception when no id is provided', function () {
|
||||||
|
$this->expectException('Wearepixel\Cart\Exceptions\InvalidItemException');
|
||||||
|
$this->expectExceptionMessage('The id field is required.');
|
||||||
|
$this->cart->add('', 'Sample Item', 100.99, 2, []);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should throw an exception when no name is provided', function () {
|
||||||
|
$this->expectException('Wearepixel\Cart\Exceptions\InvalidItemException');
|
||||||
|
$this->expectExceptionMessage('The name field is required.');
|
||||||
|
$this->cart->add(523, '', 100.99, 2, []);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('cart items attributes', function () {
|
test('cart items attributes', function () {
|
||||||
@@ -222,13 +406,6 @@
|
|||||||
expect($item['quantity'])->toEqual(5, 'Item quantity should be 5');
|
expect($item['quantity'])->toEqual(5, 'Item quantity should be 5');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('item price should be normalized when added to cart', function () {
|
|
||||||
// add a price in a string format should be converted to float
|
|
||||||
$this->cart->add(455, 'Sample Item', '100.99', 2, []);
|
|
||||||
|
|
||||||
expect($this->cart->getContent()->first()['price'])->toBeFloat('Cart price should be a float');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('it removes an item on cart by item id', function () {
|
test('it removes an item on cart by item id', function () {
|
||||||
$items = [
|
$items = [
|
||||||
[
|
[
|
||||||
@@ -331,8 +508,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('sub total when item quantity is updated by reduced', function () {
|
test('sub total when item quantity is updated by reduced', function () {
|
||||||
// $this->cart->setConfig(['format_numbers' => true, 'decimals' => 2, 'dec_point' => '.', 'thousands_sep' => ',']);
|
|
||||||
|
|
||||||
$items = [
|
$items = [
|
||||||
[
|
[
|
||||||
'id' => 456,
|
'id' => 456,
|
||||||
@@ -398,21 +573,6 @@
|
|||||||
expect($item['quantity'])->toEqual(3, 'Item quantity of with item ID of 456 should now be reduced to 2');
|
expect($item['quantity'])->toEqual(3, 'Item quantity of with item ID of 456 should now be reduced to 2');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should throw exception when provided invalid values scenario one', function () {
|
|
||||||
$this->expectException('Wearepixel\Cart\Exceptions\InvalidItemException');
|
|
||||||
$this->cart->add(455, 'Sample Item', 100.99, 0, []);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should throw exception when provided invalid values scenario two', function () {
|
|
||||||
$this->expectException('Wearepixel\Cart\Exceptions\InvalidItemException');
|
|
||||||
$this->cart->add('', 'Sample Item', 100.99, 2, []);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should throw exception when provided invalid values scenario three', function () {
|
|
||||||
$this->expectException('Wearepixel\Cart\Exceptions\InvalidItemException');
|
|
||||||
$this->cart->add(523, '', 100.99, 2, []);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('clearing cart', function () {
|
test('clearing cart', function () {
|
||||||
$items = [
|
$items = [
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user