show brands
This commit is contained in:
parent
9e77667360
commit
c431ffbb83
|
|
@ -11,7 +11,9 @@
|
|||
|
||||
namespace Beike\Services;
|
||||
|
||||
use Beike\Repositories\BrandRepo;
|
||||
use Beike\Repositories\ProductRepo;
|
||||
use Beike\Shop\Http\Resources\BrandDetail;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DesignService
|
||||
|
|
@ -79,10 +81,10 @@ class DesignService
|
|||
*/
|
||||
private static function handleBrand($content): array
|
||||
{
|
||||
$brands = $content['brands'];
|
||||
$brandIds = $content['brands'] ?? [];
|
||||
$brands = BrandDetail::collection(BrandRepo::getListByIds($brandIds))->jsonSerialize();
|
||||
|
||||
|
||||
$content['brands'] = [];
|
||||
$content['brands'] = $brands;
|
||||
$content['title'] = $content['title'][locale()];
|
||||
return $content;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ use Illuminate\Http\Resources\Json\JsonResource;
|
|||
|
||||
class BrandDetail extends JsonResource
|
||||
{
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -22,6 +25,7 @@ class BrandDetail extends JsonResource
|
|||
'name' => $this->name,
|
||||
'logo' => image_resize($this->logo),
|
||||
'sort_order' => $this->sort_order,
|
||||
'url'=> shop_route('brands.show', $this->id),
|
||||
'first' => $this->first,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue