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