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