27 lines
681 B
PHP
27 lines
681 B
PHP
<?php
|
|
namespace addon\carmi\app\model;
|
|
|
|
use core\base\BaseModel;
|
|
|
|
class Test extends BaseModel
|
|
{
|
|
public function searchNumberAttr($query, $value, $data)
|
|
{
|
|
if ($value) {
|
|
$query->where('number','like', '%'.$value . '%');
|
|
}
|
|
}
|
|
public function searchCreateTimeAttr($query, $value, $data)
|
|
{
|
|
if ($value) {
|
|
$timestamp = strtotime($value);
|
|
$query->where([['create_time', '>=', $timestamp]]);
|
|
}
|
|
}
|
|
public function searchStateAttr($query, $value, $data)
|
|
{
|
|
if($value == 0 || $value == 1 ){
|
|
$query->where([['state', '=', $value]]);
|
|
}
|
|
}
|
|
} |