Skip to content

Commit

Permalink
Merge branch '0.8' into pr/1290
Browse files Browse the repository at this point in the history
  • Loading branch information
glennjacobs committed May 6, 2024
2 parents 274f5dd + e616cb0 commit 838b25e
Show file tree
Hide file tree
Showing 129 changed files with 2,385 additions and 689 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_size = 4
indent_style = space
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
19 changes: 19 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
/docs export-ignore
/packages/**/tests export-ignore
/utils/**/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/monorepo-builder.php export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml export-ignore
/pint.json export-ignore
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: "\U0001F41B Bug report"
about: Report something that's broken.
title: ''
labels: bug
labels: bug,unconfirmed
assignees: ''

---
Expand Down
19 changes: 11 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/vendor/
composer.lock
/vendor
.phpunit.result.cache
/.DS_Store
/.fleet
/.idea
/.nova
/.phpunit.cache
/.vscode
node_modules/
yarn.lock
/node_modules
/vendor

.phpunit.result.cache
composer.lock
package-lock.json
.DS_Store
.nova
phpstan.neon
Thumbs.db
yarn.lock
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This repository serves as a monorepo for the main packages that make up Lunar.
## Community

- [Join our discord server](https://discord.gg/v6qVWaf) and chat to the developers and people using Lunar.
- [We have a roadmap](https://github.com/orgs/lunarphp/projects/1) where we will be detailing which features are next.
- [We have a roadmap](https://github.com/orgs/lunarphp/projects/8) where we will be detailing which features are next.

## Packages in this monorepo

Expand Down
4 changes: 2 additions & 2 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export default defineConfig({
]
},
{
text: '0.6',
text: '0.8',
items: [
{text: 'Changelog', link: '/core/upgrading'},
{text: 'Contributing', link: '/core/contributing'},
{text: 'Docs Next', link: 'https://docs-next.lunarphp.io/'}
{text: '1.x Docs', link: 'https://docs-v1.lunarphp.io/'}
]
}
],
Expand Down
6 changes: 0 additions & 6 deletions docs/core/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ You can contribute to the project in many different ways. Reporting bugs, fixing

Lunar uses a monorepo [lunarphp/lunar](https://github.com/lunarphp/lunar) approach to maintaining its codebase. [Monorepos](https://en.wikipedia.org/wiki/Monorepo) are quite common, but may not be familiar to some. The monorepo helps us to organise the code for ease of development.

## Repository Branching

**Bug Fixes** should target the latest compatible branch version i.e `0.6`. The `main` branch should never have bug fix PR's unless they fix features that are in an upcoming release.

**Features** that bring new (or enhance current) functionality to Lunar should always target the `main` branch.

## Contributing Code

The basic process for contributing to Lunar is as follows...
Expand Down
32 changes: 31 additions & 1 deletion docs/core/reference/carts.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ CartSession::add($purchasable, $quantity);
```php
CartSession::addLines([
[
'id' => 1,
'purchasable' => \Lunar\Models\ProductVariant::find(123),
'quantity' => 25,
'meta' => ['foo' => 'bar'],
],
Expand Down Expand Up @@ -466,3 +466,33 @@ return [
```

In most cases you won't need to change this.

## Pruning cart data

Over time you will experience a build up of carts in your database that you may want to regularly remove.

You can enable automatic removal of these carts using the `lunar.carts.prune_tables.enabled` config. By setting this to `true` any carts without an order associated will be removed after 90 days.

You can change the number of days carts are retained for using the `lunar.carts.prune_tables. prune_interval` config.

If you have specific needs around pruning you can also change the `lunar.carts.prune_tables.pipelines` array to determine what carts should be removed.



```php
return [
// ...
'prune_tables' => [

'enabled' => false,

'pipelines' => [
Lunar\Pipelines\CartPrune\PruneAfter::class,
Lunar\Pipelines\CartPrune\WithoutOrders::class,
],

'prune_interval' => 90, // days

],
];
```
4 changes: 2 additions & 2 deletions docs/core/reference/customers.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ $myModel->scheduleCustomerGroup(
// Schedule the product to be enabled straight away
$myModel->scheduleCustomerGroup($customerGroup);

// The schedule method will accept and array or collection of customer groups.
// The schedule method will accept an array or collection of customer groups.
$myModel->scheduleCustomerGroup(CustomerGroup::get());
```

Expand Down Expand Up @@ -217,7 +217,7 @@ You can override any of these yourself as they are merged behind the scenes.

The `HasCustomerGroup` trait adds a `customerGroup` scope to the model. This lets you query based on availability for a specific or multiple customer groups.

The scope will accept either a single ID or instance of `CustomerGroup` and will accept accept an array.
The scope will accept either a single ID or instance of `CustomerGroup` and will accept an array.

```php
$results = MyModel::customerGroup(1, $startDate, $endDate)->paginate();
Expand Down
8 changes: 8 additions & 0 deletions docs/core/reference/discounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ Discount::usable()->get();
Discount::products($productIds, $type = 'condition');
```

### Resetting the discount cache

For performance reasons the applicable discounts are cached per request. If you need to reset this cache (for example after adding a discount code) you should call `resetDiscounts()`:

```php
Discount::resetDiscounts();
```

## Discount Purchasable

You can relate a purchasable to a discount via this model. Each has a type for whether it's a `condition` or `reward`.
Expand Down
15 changes: 15 additions & 0 deletions docs/core/reference/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,18 @@ class YourCustomModel extends Model
```

Now your models will auto generate transforms as defined in your configuration and still use medialibrary under the hood.

## Use custom disk

By default, media is stored on the `public` disk. If you want to use a different disk, you need to set the environment variable `MEDIA_DISK` to the name of the disk you want to use.

```shell
MEDIA_DISK=s3
```
If you need more customisation, you can install publish the configuration file of `spatie/laravel-medialibrary`.

```shell
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="config"
```

Then you can change the disk in the configuration file `config/media-library.php`.
5 changes: 2 additions & 3 deletions docs/core/reference/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ $cart->canCreateOrder();
Under the hood this will use the `ValidateCartForOrderCreation` class which lunar provides and throw any validation
exceptions with helpful messages if the cart isn't ready to create an order.

You can specific you're own class to handle this in `config/cart.php`.
You can specify you're own class to handle this in `config/cart.php`.

```php
return [
Expand Down Expand Up @@ -365,8 +365,7 @@ $order->refunds; // Get all transactions that are refunds.
We will be looking to add support for the most popular payment providers, so keep an eye out here as we will list them
all out.

In the meantime, you can absolutely still get a storefront working, at the end of the day Lunar doesn't really mind if
you what payment provider you use or plan to use.
In the meantime, you can absolutely still get a storefront working, at the end of the day Lunar doesn't really mind what payment provider you use or plan to use.

In terms of an order, all it's worried about is whether or not the `placed_at` column is populated on the orders table,
the rest is completely up to you how you want to handle that. We have some helper utilities to make such things easier
Expand Down
4 changes: 2 additions & 2 deletions docs/core/reference/products.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $product->schedule($customerGroup, now()->addDays(14));
// Schedule the product to be enabled straight away
$product->schedule($customerGroup);

// The schedule method will accept and array or collection of customer groups.
// The schedule method will accept an array or collection of customer groups.
$product->schedule(CustomerGroup::get());
```

Expand Down Expand Up @@ -105,7 +105,7 @@ $product->load(['productType']);
## Product Identifiers

You can choose to add product identifiers to each product variant. These are fields which, as the name suggests, allow
you to identify a product and it's variants for use in your internal systems. You can choose whether these are required
you to identify a product and its variants for use in your internal systems. You can choose whether these are required
and unique in the hub whilst editing.

### Available fields
Expand Down
2 changes: 1 addition & 1 deletion docs/core/reference/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ If you installed the Lunar package in an existing project and you would like to
php artisan lunar:search:index
```

The command will import the records of the models listed in the `lunar/indexer.php` configuration file. Type `--help` to see the available options.
The command will import the records of the models listed in the `lunar/search.php` configuration file. Type `--help` to see the available options.

## Engine Mapping

Expand Down
4 changes: 3 additions & 1 deletion docs/core/reference/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ You can then attach tags like so:
```php
$tags = collect(['Tag One', 'Tag Two', 'Tag Three']);

$model = SomethingWithTags::syncTags($tags);
$model = SomethingWithTags::first();

$model->syncTags($tags);

$model->tags;

Expand Down
22 changes: 19 additions & 3 deletions docs/core/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,19 @@ php artisan lunar:hub:install

## Support Policy

Lunar currently provides bug fixes and security updates for only the latest minor release, e.g. `0.6`.
Lunar currently provides bug fixes and security updates for only the latest minor release, e.g. `0.7`.

## [Unreleased]
## 0.8

No significant changes.

## 0.7

### High Impact

#### TaxBreakdown casting has been refactored

Database columns which have `tax_breakdown` casting will now actually cast back into the `TaxBreakdown` object. This means you will need to update any storefront views or API transformers to accomodate this.
Database columns which have `tax_breakdown` casting will now actually cast back into the `TaxBreakdown` object. This means you will need to update any storefront views or API transformers to accommodate this.

Before:

Expand All @@ -46,6 +50,18 @@ Before:
@endforeach
```

When migrations are run, a state update routine will trigger to convert all existing `tax_breakdown` column. Please ensure you take a backup of your database beforehand and avoid running in production until you are satisfied the data is correct.

### Medium Impact

#### Discount updates

Limitations and exclusions on discounts have had a revamp, please double-check all discounts you have in Lunar to ensure they are all correct. Generally speaking the integrity should be unaffected, but it's better to be sure.

#### Calculate lines pipeline update

If you are using unit quantities greater than `1`, there was an issue in the calculate lines pipeline which resulted in the unit quantity being applied twice, so if the price was `10` with a unit quantity of `100` it would show the unit price as `0.001` instead of `0.01`. This should be resolved going forward to show correctly.

### Low Impact

#### Click & Collect parameter added to `ShippingOption`
Expand Down
8 changes: 5 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"type": "module",
"devDependencies": {
"vitepress": "^1.0.0-beta.7"
"vitepress": "^1.0.0-rc.31"
},
"scripts": {
"docs:dev": "vitepress dev",
"docs:build": "vitepress build",
"docs:preview": "vitepress preview"
}
}
},
"type": "module"
}
7 changes: 7 additions & 0 deletions packages/admin/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* text=auto eol=lf

/.github export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml export-ignore
3 changes: 2 additions & 1 deletion packages/admin/resources/lang/en/global.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,6 @@
'billing_email' => 'Billing Email',
'add_new' => 'Add new',
'tabs' => 'Tabs',
'sidebar' => 'Sidebar'
'sidebar' => 'Sidebar',
'store' => 'Store',
];
3 changes: 1 addition & 2 deletions packages/admin/resources/lang/en/partials.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
'discounts.limitations.limitation' => 'Limitation',
'discounts.limitations.exclusion' => 'Exclusion',
/**
* Product Collections.
*/
'products.collections.heading' => 'Collections',
Expand Down Expand Up @@ -133,7 +132,7 @@
'pricing.customer_groups.title' => 'Customer group pricing',
'pricing.customer_groups.strapline' => 'Determines if you would like different pricing across customer groups.',
'pricing.tiers.title' => 'Tiered Pricing',
'pricing.tiers.strapline' => 'Tired pricing allows you to offer discounted pricing based on units sold.',
'pricing.tiers.strapline' => 'Tiered pricing allows you to offer discounted pricing based on units sold.',
'pricing.non_default_currency_alert' => 'Some fields can only be changed when using the default currency.',
'pricing.tiers.add_tier_btn' => 'Add Tier',
/**
Expand Down
10 changes: 10 additions & 0 deletions packages/admin/resources/lang/fr/account.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

return [
'title' => 'Compte',
'save_btn' => 'Enregistrer',
'avatar_notice' => 'Votre avatar est généré à l\'aide de Gravatar via votre adresse email.',
'view-profile' => 'Voir mon profil',
'update_password' => 'Modifier mon mot de passe',
'logout' => 'Déconnexion',
];
Loading

0 comments on commit 838b25e

Please sign in to comment.