admin menu filter and seller
This commit is contained in:
parent
de321d9b5a
commit
0a92c9cf6d
|
|
@ -56,8 +56,15 @@ class Vendors extends V1Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
public function menus(MenuRepository $repository){
|
public function menus(MenuRepository $repository){
|
||||||
$menus = $repository->where('status',1)->with(['categories','brands'])->orderBy('position','asc')->get();
|
$vendors = $this->vendorRepository->select('marketplace_sellers.id','url','shop_title')
|
||||||
return Menu::collection($menus);
|
->where('is_approved',true)
|
||||||
|
->with(['menus' => function($query){
|
||||||
|
$query->where('status',1)
|
||||||
|
->with(['categories','brands'])
|
||||||
|
->orderBy('position','asc')
|
||||||
|
}])
|
||||||
|
return Vendor::collection($vendors)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ class Menu extends JsonResource
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'name' => $this->name,
|
'name' => $this->name,
|
||||||
|
'filter' => $this->filter,
|
||||||
'description' => $this->description,
|
'description' => $this->description,
|
||||||
'categories' => Category::collection($this->categories),
|
'categories' => Category::collection($this->categories),
|
||||||
'brands' => Brands::collection($this->brands)
|
'brands' => Brands::collection($this->brands)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ namespace Sarga\API\Http\Resources\Core;
|
||||||
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Sarga\API\Http\Resources\Catalog\Category;
|
use Sarga\API\Http\Resources\Catalog\Category;
|
||||||
|
use Sarga\API\Http\Resources\Catalog\Menu;
|
||||||
|
|
||||||
class Vendor extends JsonResource
|
class Vendor extends JsonResource
|
||||||
{
|
{
|
||||||
|
|
@ -17,15 +18,9 @@ class Vendor extends JsonResource
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'url' => $this->url,
|
|
||||||
'shop_title' => $this->shop_title,
|
'shop_title' => $this->shop_title,
|
||||||
'logo' => $this->logo_url,
|
'logo' => $this->logo_url,
|
||||||
'banner' => $this->banner_url,
|
'menus' => Menu::collection($this->menus)
|
||||||
'brand_id' => $this->brand_attribute_id,
|
|
||||||
$this->mergeWhen(!empty($this->main_categories) && $this->main_categories->count(),[
|
|
||||||
'categories' => Category::collection($this->main_categories)
|
|
||||||
])
|
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue