Closed
Conversation
using same listener name as filament panel
Fixes a typo in the example of CartSession::addLines usage. The implementation of [addLines](https://github.com/lunarphp/lunar/blob/7f41cf66ebc96ee7465a84c8a4c4dd24228bf47d/packages/core/src/Models/Cart.php#L337C10-L337C10) currently expects a purchasable instance as below: ```php public function add(Purchasable $purchasable, int $quantity = 1, array $meta = [], bool $refresh = true): Cart { foreach (config('lunar.cart.validators.add_to_cart', []) as $action) { // Throws a validation exception? app($action)->using( cart: $this, purchasable: $purchasable, quantity: $quantity, meta: $meta )->validate(); } return app( config('lunar.cart.actions.add_to_cart', AddOrUpdatePurchasable::class) )->execute($this, $purchasable, $quantity, $meta) ->then(fn () => $refresh ? $this->refresh()->calculate() : $this); } public function addLines(iterable $lines): Cart { DB::transaction(function () use ($lines) { collect($lines)->each(function ($line) { $this->add( purchasable: $line['purchasable'], quantity: $line['quantity'], meta: (array) ($line['meta'] ?? null), refresh: false ); }); }); return $this->refresh()->calculate(); } ``` Co-authored-by: Alec Ritson <hello@itsalec.co.uk>
This PR adds a command `lunar:prune:carts` and some new config params under `lunar.cart.prune_tables` to determine how pruning should be carried out. I opted for using a pipeline for amending the query, as we ultimately always seem to end up there. I've tried to default to some sensible settings (90 days, dont prune carts with orders associated). If pruning is enabled we automatically add a daily task rather then needing the developer to do it. --------- Co-authored-by: Glenn Jacobs <glenn@neondigital.co.uk>
This PR adds the ability to reset the DiscountManager query cache - this is necessary if you add a discount coupon and want to update the cart totals in the same request. --------- Co-authored-by: Glenn Jacobs <glenn@neondigital.co.uk>
I am getting an error when the transaction model is null when viewing an order with only an intent transaction. Adding this null check fixes the error. Co-authored-by: Glenn Jacobs <glenn@neondigital.co.uk>
Regression test to ensure that `mappedAttributes` returns the correct class and also the `collections` relationship on products has the correct model referenced Co-authored-by: Glenn Jacobs <glenn@neondigital.co.uk>
Merge 0.7 into 0.8
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Fix typo in pricing tiers strapline.
Collaborator
|
Closing in favour of #1601 since we should be using an intermediary brach when merging between versions as fixing the conflicts would require commits directly on the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.