fix filters
This commit is contained in:
parent
b3d31f48eb
commit
f10bc1e2fe
|
|
@ -42,7 +42,16 @@ class Products extends ProductController
|
|||
*/
|
||||
public function get($id)
|
||||
{
|
||||
return ($product = $this->productRepository->find($id))?
|
||||
$sku = request()->has('sku');
|
||||
|
||||
if($sku){
|
||||
$product = $this->productRepository->findOneByField('sku',$id);
|
||||
}
|
||||
else{
|
||||
$product = $this->productRepository->find($id);
|
||||
}
|
||||
|
||||
return ($product)?
|
||||
new ProductResource($product) :
|
||||
response()->json(['error' => 'not found'],404);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue