brendler
This commit is contained in:
parent
e5b75a92ef
commit
6d53ddd200
|
|
@ -1,19 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Sarga\API\Http\Controllers;
|
||||
|
||||
use Webkul\API\Http\Controllers\Shop\ResourceController;
|
||||
|
||||
class Resources extends ResourceController
|
||||
{
|
||||
public function get($code){
|
||||
$query = isset($this->_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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
]);
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue