<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Grid\Filter; use ModStart\Core\Util\StrUtil; class Like extends AbstractFilter { private $handle = null; public function condition($r8NJk) { if (isset($r8NJk['like']) && $r8NJk['like'] !== '') { if (!empty($this->handle)) { return call_user_func_array($this->handle, array($r8NJk['like'])); } else { return $this->buildCondition($this->column, 'like', "%{$r8NJk['like']}%"); } } return null; } public function handle(\Closure $smpQd) { $this->handle = $smpQd; } public function wordSplit() { $this->handle = function ($l15kG) { return array(array('where' => array(function ($qeoqS) use($l15kG) { $KHn4u = StrUtil::wordSplit($l15kG); foreach ($KHn4u as $PhYE_) { $qeoqS->where($this->column, 'like', '%' . $PhYE_ . '%'); } }))); }; } }