In.php 661 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Dcat\Admin\Grid\Filter;
  3. use Illuminate\Support\Arr;
  4. class In extends AbstractFilter
  5. {
  6. /**
  7. * {@inheritdoc}
  8. */
  9. protected $query = 'whereIn';
  10. /**
  11. * @var int
  12. */
  13. protected $width = 12;
  14. /**
  15. * Get condition of this filter.
  16. *
  17. * @param array $inputs
  18. *
  19. * @return mixed
  20. */
  21. public function condition($inputs)
  22. {
  23. $value = Arr::get($inputs, $this->column);
  24. if ($value === null) {
  25. return;
  26. }
  27. $this->value = is_array($value) ? $value : explode(',', $value);
  28. return $this->buildCondition($this->column, $this->value);
  29. }
  30. }