Skip to content

Commit

Permalink
adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Nov 2, 2023
1 parent e7c6c85 commit 923a8fc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 63 deletions.
29 changes: 0 additions & 29 deletions src/Fields/Prices.php

This file was deleted.

19 changes: 4 additions & 15 deletions src/Resources/CategoryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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']),

Expand Down
26 changes: 8 additions & 18 deletions src/Resources/ProductResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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')
Expand All @@ -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'),
]);
Expand Down
1 change: 0 additions & 1 deletion tests/Feature/GatewayManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 923a8fc

Please sign in to comment.