From 6d53ddd2005d9fb059aa7819770f119564b64031 Mon Sep 17 00:00:00 2001 From: merdan Date: Thu, 28 Oct 2021 21:36:04 +0500 Subject: [PATCH] brendler --- .../Sarga/API/Http/Controllers/Resources.php | 19 ------------------- .../Sarga/API/Http/Resources/Core/Channel.php | 3 ++- packages/Sarga/API/Http/routes.php | 12 ++++++------ 3 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 packages/Sarga/API/Http/Controllers/Resources.php diff --git a/packages/Sarga/API/Http/Controllers/Resources.php b/packages/Sarga/API/Http/Controllers/Resources.php deleted file mode 100644 index a86480d87..000000000 --- a/packages/Sarga/API/Http/Controllers/Resources.php +++ /dev/null @@ -1,19 +0,0 @@ -_config['authorization_required']) && $this->_config['authorization_required'] ? - $this->repository->where(['customer_id'=>auth()->user()->id,'code'=>$code])->first() : - $this->repository->where('code',$code)->first(); - - if($query) - return new $this->_config['resource']($query); - else - return response()->json(['status'=>false,'message'=>'Not found'],404); - } -} \ No newline at end of file diff --git a/packages/Sarga/API/Http/Resources/Core/Channel.php b/packages/Sarga/API/Http/Resources/Core/Channel.php index e8bd2c3b7..51ee54dff 100644 --- a/packages/Sarga/API/Http/Resources/Core/Channel.php +++ b/packages/Sarga/API/Http/Resources/Core/Channel.php @@ -23,7 +23,8 @@ class Channel extends JsonResource 'hostname' => $this->hostname, 'root_category_id' => $this->root_category_id, 'is_maintenance_on' => $this->is_maintenance_on, - 'sliders' => Slider::collection($this->sliders) + 'sliders' => Slider::collection($this->sliders), + 'brand_attribute_id' => 25 //todo vremenno goyuldy. id admindan bazadan settingsden almaly(2 marketplace goshulanda) // 'root_category' => $this->when($this->root_category_id, new CategoryResource($this->root_category)), // 'main_categories' => $this->when(request()->has('channel_id'),Category::collection($this->categories)) diff --git a/packages/Sarga/API/Http/routes.php b/packages/Sarga/API/Http/routes.php index e91effada..005955550 100644 --- a/packages/Sarga/API/Http/routes.php +++ b/packages/Sarga/API/Http/routes.php @@ -2,9 +2,9 @@ use Sarga\API\Http\Controllers\Categories; use Sarga\API\Http\Controllers\Channels; -use Sarga\API\Http\Controllers\Resources; -use Webkul\Attribute\Repositories\AttributeRepository; -use Sarga\API\Http\Resources\Catalog\Attribute; +use Webkul\API\Http\Controllers\Shop\ResourceController; +use Webkul\Attribute\Repositories\AttributeOptionRepository; +use Sarga\API\Http\Resources\Catalog\AttributeOption; Route::group(['prefix' => 'api'], function ($router) { Route::group(['middleware' => ['locale', 'currency']], function ($router) { @@ -16,9 +16,9 @@ Route::group(['prefix' => 'api'], function ($router) { Route::get('category-brands/{id}', [Categories::class, 'brands']); //attributes by code - Route::get('attribute-by-code/{code}', [Resources::class, 'get'])->defaults('_config', [ - 'repository' => AttributeRepository::class, - 'resource' => Attribute::class, + Route::get('attribute-options', [ResourceController::class, 'index'])->defaults('_config', [ + 'repository' => AttributeOptionRepository::class, + 'resource' => AttributeOption::class, ]); });