SeoMetaService.php 773 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Services;
  3. use App\Services\CallApiService;
  4. class SeoMetaService
  5. {
  6. private $callApiService;
  7. public function __construct(CallApiService $callApiService)
  8. {
  9. $this->callApiService = $callApiService;
  10. }
  11. public function itemDetailsSeo($slug): array
  12. {
  13. $itemPick = $this->callApiService->callApi([
  14. 'url' => 'item-pick',
  15. 'data' => [
  16. 'Page' => [ [ 'ItemSlug' => $slug ] ]
  17. ]
  18. ]);
  19. if ($this->callApiService->verifyApiError($itemPick)) {
  20. return [ 'error' => true, 'message' => $itemPick['body'] ];
  21. } else {
  22. $item_id = $itemPick['Page'][0]['Id'];
  23. }
  24. return [ 'error' => false, 'data' => $item_id ];
  25. }
  26. }