35 lines
717 B
PHP
35 lines
717 B
PHP
|
<?php
|
||
|
|
||
|
namespace app\model;
|
||
|
|
||
|
trait SearcherTrait
|
||
|
{
|
||
|
public function searchSiteIdAttr($query, $value, $data)
|
||
|
{
|
||
|
if (!empty($value)) {
|
||
|
$query->where('site_id', $value);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function searchStateAttr($query, $value, $data)
|
||
|
{
|
||
|
if (!empty($value)) {
|
||
|
$query->where('state', $value);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function searchStatusAttr($query, $value, $data)
|
||
|
{
|
||
|
if (!empty($value)) {
|
||
|
$query->where('status', $value);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public function searchCreateTimeAttr($query, $value, $data)
|
||
|
{
|
||
|
if (!empty($value)) {
|
||
|
$query->whereBetweenTime('create_time', $value[0], $value[1]);
|
||
|
}
|
||
|
}
|
||
|
}
|