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