main screen categories and products

This commit is contained in:
merdan 2022-01-20 11:54:44 +05:00
parent 59d32d9a78
commit 7c54b469bc
2 changed files with 5 additions and 1 deletions

View File

@ -43,6 +43,7 @@ class Vendors extends Controller
->with(['children'=> function($q){
$q->orderBy('position','asc');
}])
->orderBy('position','asc')
->get();
}

View File

@ -22,7 +22,10 @@ class Vendor extends JsonResource
'logo' => $this->logo_url,
'banner' => $this->banner_url,
'brand_id' => $this->brand_attribute_id,
'categories' => Category::collection($this->main_categories),
$this->mergeWhen(!empty($this->main_categories),[
'categories' => Category::collection($this->main_categories)
])
];
}
}