Withdraw.php 851 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: yunzhong
  5. * Date: 2018/11/14
  6. * Time: 9:56
  7. */
  8. namespace app\backend\modules\charts\models;
  9. use app\common\scopes\UniacidScope;
  10. class Withdraw extends \app\common\models\Withdraw
  11. {
  12. public static function boot()
  13. {
  14. parent::boot();
  15. self::addGlobalScope(new UniacidScope);
  16. }
  17. public function scopeSearch($query, $search)
  18. {
  19. if ($search['is_time']) {
  20. $query->whereBetween('created_at',[strtotime($search['time']['start']), strtotime($search['time']['end'])]);
  21. }
  22. if (!empty($search['type'])) {
  23. $query->whereType($search['type']);
  24. }
  25. return $query;
  26. }
  27. public static function getTypes()
  28. {
  29. $configs = \app\backend\modules\income\Income::current()->getItems();
  30. return $configs;
  31. }
  32. }