TplRepository.php 694 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: wuzhenke
  5. * Date: 2018/12/13
  6. * Time: 14:04
  7. */
  8. namespace App\Repositories;
  9. use App\Models\Tpl;
  10. use Prettus\Repository\Criteria\RequestCriteria;
  11. use Prettus\Repository\Eloquent\BaseRepository;
  12. class TplRepository extends BaseRepository
  13. {
  14. public function model()
  15. {
  16. return Tpl::class;
  17. }
  18. public function boot()
  19. {
  20. $this->pushCriteria(app(RequestCriteria::class));
  21. }
  22. public function findTpl($where)
  23. {
  24. $where['display'] = 1;
  25. return $this->model->where($where)->get();
  26. }
  27. public function getDefaultTpl($where)
  28. {
  29. return $this->model->where($where)->first();
  30. }
  31. }