TaskRepository.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\Task;
  4. use Prettus\Repository\Eloquent\BaseRepository;
  5. use Prettus\Repository\Criteria\RequestCriteria;
  6. /**
  7. * Class MemberRepositoryEloquent.
  8. *
  9. * @package namespace App\Repositories;
  10. */
  11. class TaskRepository extends BaseRepository
  12. {
  13. /**
  14. * Specify Model class name
  15. *
  16. * @return string
  17. */
  18. public function model()
  19. {
  20. return Task::class;
  21. }
  22. /**
  23. * Boot up the repository, pushing criteria
  24. */
  25. public function boot()
  26. {
  27. $this->pushCriteria(app(RequestCriteria::class));
  28. }
  29. public function getTaskById($id)
  30. {
  31. return $this->model->find($id);
  32. }
  33. public function getTaskByUtype($utype)
  34. {
  35. return $this->model->where(['utype'=>$utype,'status'=>1])->get();
  36. }
  37. public function getAllPoints($utype)
  38. {
  39. return $this->model->where(['utype'=>$utype])->get();
  40. }
  41. public function getPoint($where)
  42. {
  43. return $this->model->where($where)->value('points');
  44. }
  45. }