From 923a8fccb84d4fcc4da015042d9a1c65f43f616b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Thu, 2 Nov 2023 15:02:25 +0100 Subject: [PATCH] adjustments --- src/Fields/Prices.php | 29 ---------------------------- src/Resources/CategoryResource.php | 19 ++++-------------- src/Resources/ProductResource.php | 26 ++++++++----------------- tests/Feature/GatewayManagerTest.php | 1 - 4 files changed, 12 insertions(+), 63 deletions(-) delete mode 100644 src/Fields/Prices.php diff --git a/src/Fields/Prices.php b/src/Fields/Prices.php deleted file mode 100644 index 85269af4..00000000 --- a/src/Fields/Prices.php +++ /dev/null @@ -1,29 +0,0 @@ - 'HUF']), 'price_huf') - ->asNumber(), - ]; - } -} diff --git a/src/Resources/CategoryResource.php b/src/Resources/CategoryResource.php index 8b3e7a14..ed2a38e0 100644 --- a/src/Resources/CategoryResource.php +++ b/src/Resources/CategoryResource.php @@ -3,9 +3,8 @@ namespace Cone\Bazar\Resources; use Cone\Bazar\Models\Category; -use Cone\Root\Columns\Column; -use Cone\Root\Columns\ID; use Cone\Root\Fields\Editor; +use Cone\Root\Fields\ID; use Cone\Root\Fields\Slug; use Cone\Root\Fields\Text; use Cone\Root\Resources\Resource; @@ -21,24 +20,14 @@ class CategoryResource extends Resource /** * Define the fields. */ - public function columns(Request $request): array + public function fields(Request $request): array { return [ ID::make(), - Column::make(__('Name'), 'name') - ->sortable() - ->searchable(), - ]; - } - - /** - * Define the fields. - */ - public function fields(Request $request): array - { - return [ Text::make(__('Name'), 'name') + ->sortable() + ->searchable() ->required() ->rules(['required', 'string', 'max:256']), diff --git a/src/Resources/ProductResource.php b/src/Resources/ProductResource.php index f536cec5..2f911b6c 100644 --- a/src/Resources/ProductResource.php +++ b/src/Resources/ProductResource.php @@ -2,13 +2,12 @@ namespace Cone\Bazar\Resources; -use Cone\Bazar\Fields\Prices; use Cone\Bazar\Models\Product; -use Cone\Root\Columns\Column; -use Cone\Root\Columns\ID; use Cone\Root\Fields\BelongsToMany; use Cone\Root\Fields\Editor; +use Cone\Root\Fields\ID; use Cone\Root\Fields\Media; +use Cone\Root\Fields\Meta; use Cone\Root\Fields\Slug; use Cone\Root\Fields\Text; use Cone\Root\Resources\Resource; @@ -21,27 +20,17 @@ class ProductResource extends Resource */ protected string $model = Product::class; - /** - * Define the columns. - */ - public function columns(Request $request): array - { - return array_merge(parent::columns($request), [ - ID::make(), - - Column::make(__('Name'), 'name') - ->sortable() - ->searchable(), - ]); - } - /** * Define the fields. */ public function fields(Request $request): array { return array_merge(parent::fields($request), [ + ID::make(), + Text::make(__('Name'), 'name') + ->sortable() + ->searchable() ->rules(['required', 'string', 'max:256']), Slug::make(__('Slug'), 'slug') @@ -52,7 +41,8 @@ public function fields(Request $request): array BelongsToMany::make(__('Categories'), 'categories') ->display('name'), - Prices::make(), + Meta::make(__('Price :currency', ['currency' => 'HUF']), 'price_huf') + ->asNumber(), Media::make(__('Cover'), 'media', 'media'), ]); diff --git a/tests/Feature/GatewayManagerTest.php b/tests/Feature/GatewayManagerTest.php index 9d3e88b9..e4e1b521 100644 --- a/tests/Feature/GatewayManagerTest.php +++ b/tests/Feature/GatewayManagerTest.php @@ -16,7 +16,6 @@ use Cone\Bazar\Tests\TestCase; use Exception; use Illuminate\Notifications\AnonymousNotifiable; -use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Notification; class GatewayManagerTest extends TestCase