StartWith.php 649 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Dcat\Admin\Grid\Filter;
  3. use Illuminate\Support\Arr;
  4. class StartWith extends AbstractFilter
  5. {
  6. protected $type = 'like';
  7. /**
  8. * Get condition of this filter.
  9. *
  10. * @param array $inputs
  11. *
  12. * @return array|mixed|void
  13. */
  14. public function condition($inputs)
  15. {
  16. $value = Arr::get($inputs, $this->column);
  17. if ($value === null) {
  18. return;
  19. }
  20. $this->value = $value;
  21. return $this->buildCondition($this->column, $this->type, "{$this->value}%");
  22. }
  23. public function ilike()
  24. {
  25. $this->type = 'ilike';
  26. return $this;
  27. }
  28. }