Skip to content

Commit

Permalink
Merge branch '1.x' into fix/null-values-in-attribute-cast
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson authored May 23, 2024
2 parents df022bd + fe6108a commit 50970b9
Show file tree
Hide file tree
Showing 131 changed files with 2,030 additions and 222 deletions.
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
}
],
"require": {
"awcodes/filament-badgeable-column": "^2.3.2",
"awcodes/shout": "^2.0.2",
"barryvdh/laravel-dompdf": "^2.0",
"dompdf/dompdf": "^2.0.7",
"cartalyst/converter": "^8.0|^9.0",
"doctrine/dbal": "^3.6",
"dompdf/dompdf": "^2.0.7",
"ext-bcmath": "*",
"ext-exif": "*",
"ext-intl": "*",
Expand All @@ -40,6 +41,7 @@
"larastan/larastan": "^2.9",
"laravel/pint": "1.13.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
Expand Down
44 changes: 43 additions & 1 deletion docs/admin/extending/pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ class MyCreateExtension extends CreatePageExtension
{
return $title . ' - Example';
}

public function getTabs(array $tabs): array
{
return [
...$tabs,
'review' => Tab::make('Review')
->modifyQueryUsing(fn (Builder $query) => $query->where('status', 'review')),
];
}

public function headerWidgets(array $widgets): array
{
Expand Down Expand Up @@ -268,10 +277,26 @@ An example of extending a view page.

```php
use Filament\Actions;

use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Filament\Infolists\Infolist;
use Filament\Infolists\Components\TextEntry;
use Lunar\Admin\Support\Extending\ViewPageExtension;
use Lunar\Admin\Filament\Widgets;

class MyViewExtension extends ViewPageExtension
{
public function headerWidgets(array $widgets): array
{
$widgets = [
...$widgets,
Widgets\Dashboard\Orders\OrderStatsOverview::make(),
];

return $widgets;
}

public function heading($title): string
{
return $title . ' - Example';
Expand All @@ -293,7 +318,24 @@ class MyViewExtension extends ViewPageExtension

return $actions;
}


public function extendsInfolist(Infolist $infolist): Infolist
{
return $infolist->schema([
...$infolist->getComponents(true),
TextEntry::make('custom_title'),
]);
}

public function footerWidgets(array $widgets): array
{
$widgets = [
...$widgets,
Widgets\Dashboard\Orders\LatestOrdersTable::make(),
];

return $widgets;
}
}

// Typically placed in your AppServiceProvider file...
Expand Down
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
5 changes: 2 additions & 3 deletions docs/core/reference/orders.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,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
14 changes: 14 additions & 0 deletions docs/core/reference/payments.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,20 @@ $order->charges; // Get all transactions that are charges.
$order->refunds; // Get all transactions that are refunds.
```
### Payment Checks
Some providers return information based on checks that can occur before payment is validated and completed.
This is usually related to 3DSecure but in some cases can relate to credit checks or anything the payment provider has deemed relevant to the transaction.
You can get access to these checks via the `paymentChecks()` method on the `Transaction`.
```php
foreach($transaction->paymentChecks() as $check) {
$check->successful;
$check->label;
$check->message;
}
```
## Payments
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.
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.

## Meilisearch

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
15 changes: 15 additions & 0 deletions docs/core/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ php artisan migrate

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

## 1.0.0-alpha.20

### High Impact

#### Stripe addon facade change

If you are using the Stripe addon, you need to update the facade as the name has changed.

```php
// Old
\Lunar\Stripe\Facades\StripeFacade;

// New
\Lunar\Stripe\Facades\Stripe;
```

## 1.0

Expand Down
6 changes: 6 additions & 0 deletions packages/admin/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* text=auto eol=lf

/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml export-ignore
3 changes: 3 additions & 0 deletions packages/admin/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: [lunar]
13 changes: 13 additions & 0 deletions packages/admin/.github/workflows/close-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Close Pull Request

on:
pull_request_target:
types: [opened]

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: "Thank you for your pull request. However, you have submitted this PR on the Lunar Admin Repo which is a read-only sub split of `lunarphp/lunar`. Please submit your PR on the https://github.com/lunarphp/lunar repository.<br><br>Thanks!"
3 changes: 2 additions & 1 deletion packages/admin/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"technikermathe/blade-lucide-icons": "^v3.0",
"marvinosswald/filament-input-select-affix": "^0.2.0",
"leandrocfe/filament-apex-charts": "^3.1.3",
"awcodes/shout": "^2.0.2"
"awcodes/shout": "^2.0.2",
"awcodes/filament-badgeable-column": "^2.3.2"
},
"extra": {
"laravel": {
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/resources/dist/lunar-panel.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion packages/admin/resources/dist/lunar-panel.js
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJzb3VyY2VzQ29udGVudCI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K
3 changes: 3 additions & 0 deletions packages/admin/resources/lang/en/productoption.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
'handle' => [
'label' => 'Handle',
],
'shared' => [
'label' => 'Shared',
],
],

'form' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'!border-red-500 bg-red-50' => !$transaction->success,
'bg-gray-50' => $transaction->success,
])
>
>
<div class="p-2 space-y-2">
<div class="px-4 py-2 rounded text-xs bg-white dark:bg-gray-800 shadow text-gray-600 dark:text-gray-400 ring-1 ring-gray-100 dark:ring-gray-700">
<span>{{ $transaction->driver }}</span> //
Expand Down Expand Up @@ -53,7 +53,7 @@
@endif
</div>

<strong
<strong
@class([
"text-sm",
'text-red-500' => !$transaction->success,
Expand All @@ -75,26 +75,19 @@
class="w-4"
/>
</div>

<span>{{ $transaction->created_at->format('jS F Y h:ma') }}</span>
<span>{{ $transaction->created_at->format('jS F Y h:ia') }}</span>
</div>

@if($threeD = $transaction->meta['threedSecure'] ?? null)
<div class="flex space-x-2">
@foreach([
'address' => 'Address',
'postalCode' => 'Postal Code',
'securityCode' => 'Security Code',
] as $metaKey => $metaLabel)
<x-filament::badge
:icon="$threeD[$metaKey] ?? false ? 'heroicon-m-check' : 'heroicon-m-x-mark'"
:color="$threeD[$metaKey] ?? false ? \Filament\Support\Colors\Color::Sky : 'gray'"
>
{{ $metaLabel }}
</x-filament::badge>
@endforeach
</div>
@endif
<div class="flex space-x-2">
@foreach($transaction->paymentChecks() as $check)
<x-filament::badge
:icon="$check->successful ? 'heroicon-m-check' : 'heroicon-m-x-mark'"
:color="$check->successful ? \Filament\Support\Colors\Color::Sky : 'gray'"
>
{{ $check->label }}: {{ $check->message }}
</x-filament::badge>
@endforeach
</div>
</div>

@if($transaction->notes)
Expand All @@ -111,7 +104,7 @@ class="w-4"
@endif
</div>

<div
<div
@class([
"bottom-0 left-0 block w-full text-center rounded-b-lg border-t text-xs py-1",
"!bg-red-50 !dark:bg-red-400/10 !border-red-300 !text-red-600 !dark:text-red-400" => !$transaction->success,
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/Filament/Resources/BrandResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected static function getTableColumns(): array
{
return [
SpatieMediaLibraryImageColumn::make('thumbnail')
->collection('images')
->collection(config('lunar.media.collection'))
->conversion('small')
->limit(1)
->square()
Expand Down
14 changes: 11 additions & 3 deletions packages/admin/src/Filament/Resources/ChannelResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

namespace Lunar\Admin\Filament\Resources;

use Awcodes\FilamentBadgeableColumn\Components\Badge;
use Awcodes\FilamentBadgeableColumn\Components\BadgeableColumn;
use Filament\Forms;
use Filament\Forms\Components\Component;
use Filament\Support\Facades\FilamentIcon;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Illuminate\Support\Str;
use Lunar\Admin\Filament\Resources\ChannelResource\Pages;
Expand Down Expand Up @@ -112,14 +115,19 @@ public static function getDefaultTable(Table $table): Table
protected static function getTableColumns(): array
{
return [
Tables\Columns\TextColumn::make('name')
BadgeableColumn::make('name')
->separator('')
->suffixBadges([
Badge::make('default')
->label(__('lunarpanel::channel.table.default.label'))
->color('gray')
->visible(fn (Model $record) => $record->default),
])
->label(__('lunarpanel::channel.table.name.label')),
Tables\Columns\TextColumn::make('handle')
->label(__('lunarpanel::channel.table.handle.label')),
Tables\Columns\TextColumn::make('url')
->label(__('lunarpanel::channel.table.url.label')),
Tables\Columns\BooleanColumn::make('default')
->label(__('lunarpanel::channel.table.default.label')),
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function table(Table $table): Table
return $table->columns([

Tables\Columns\SpatieMediaLibraryImageColumn::make('thumbnail')
->collection('images')
->collection(config('lunar.media.collection'))
->conversion('small')
->limit(1)
->square()
Expand Down
Loading

0 comments on commit 50970b9

Please sign in to comment.