1. Go to this page and download the library: Download syhcode/tp-model-filter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
syhcode / tp-model-filter example snippets
namespace app\model;
use think\Model;
use tpModelFilter\Filterable;
class Users extends Model
{
use Filterable;
}
namespace app\modelFilter;
use tpModelFilter\ModelFilter;
class UsersFilter extends ModelFilter
{
public function name($value)
{
return $this->whereLike('name', $value);
}
public function status($value)
{
return $this->where('status', $value);
}
}