You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
571 B

5 years ago
  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Model\v3\Banner;
  4. use App\Service\v3\Interfaces\BannerServiceInterface;
  5. class BannerService implements BannerServiceInterface
  6. {
  7. public function all($type, $marketId)
  8. {
  9. $builder = Banner::query()
  10. ->where(['type' => $type])
  11. ->where(function ($query) use ($marketId) {
  12. $query->whereJsonContains('market_ids', [(string)$marketId])
  13. ->orWhereJsonLength('market_ids', '=', 0);
  14. });
  15. return $builder->get()->toArray();
  16. }
  17. }