BannerRepository.php 632 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\Banner;
  4. /**
  5. * Created by PhpStorm.
  6. * User: durong
  7. * Date: 2019/6/15
  8. * Time: 下午5:39
  9. */
  10. class BannerRepository
  11. {
  12. public function __construct(Banner $banner)
  13. {
  14. $this->banner = $banner;
  15. }
  16. public function bannerData($request)
  17. {
  18. $ids = explode(",", $request['ids']);
  19. $where = [];
  20. $where[] = ['is_open', 1];
  21. $where[] = ['use_background', 1];
  22. return $this->banner
  23. ->select('image', 'type', 'link_content_id')
  24. ->where($where)
  25. ->whereIn('id', $ids)
  26. ->get();
  27. }
  28. }