search suggestions finish
This commit is contained in:
parent
5b057461ed
commit
bb5beda217
|
|
@ -6,6 +6,7 @@ use Illuminate\Support\Arr;
|
|||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Sarga\API\Http\Resources\Catalog\ProductVariant;
|
||||
use Sarga\API\Http\Resources\Catalog\Suggestion;
|
||||
use Sarga\API\Http\Resources\Catalog\SuperAttribute;
|
||||
use Sarga\Brand\Repositories\BrandRepository;
|
||||
use Sarga\Shop\Repositories\ProductRepository;
|
||||
|
|
@ -163,7 +164,7 @@ class Products extends ProductController
|
|||
|
||||
}
|
||||
|
||||
return $products->merge($brands)->sortBy('name');
|
||||
return Suggestion::collection($products->merge($brands)->sortBy('name'));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace Sarga\API\Http\Resources\Catalog;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class Suggestion extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'name' => $this->name,
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue