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