You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
PHTML
39 lines
1.2 KiB
PHTML
2 years ago
|
<?php
|
||
|
|
||
|
namespace App\Scopes;
|
||
|
|
||
|
trait PromoteScopes
|
||
|
{
|
||
|
public function scopeOfConditions($query, $params)
|
||
|
{
|
||
|
if (!empty($params['level'])) {
|
||
|
$query->where('level', $params['level']);
|
||
|
}
|
||
|
if (!empty($params['parent_id'])) {
|
||
|
$query->where('parent_id', $params['parent_id']);
|
||
|
}
|
||
|
if (!empty($params['account'])) {
|
||
|
$query->where('account', 'like', '%' . $params['account'] . '%');
|
||
|
}
|
||
|
if (!empty($params['mobile'])) {
|
||
|
$query->where('mobile_phone', 'like', '%' . $params['mobile'] . '%');
|
||
|
}
|
||
|
if (!empty($params['idcard'])) {
|
||
|
$query->where('idcard', 'like', '%' . $params['idcard'] . '%');
|
||
|
}
|
||
|
if (!empty($params['realname'])) {
|
||
|
$query->where('real_name', 'like', '%' . $params['realname'] . '%');
|
||
|
}
|
||
|
if (isset($params['status']) && $params['status'] != -1) {
|
||
|
$query->where('status', $params['status']);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 查找子推广账号
|
||
|
*/
|
||
|
public function scopeOfParent($query, $promote)
|
||
|
{
|
||
|
return $query->where('chain', 'like', $promote->chain . $promote->id . '/%');
|
||
|
}
|
||
|
}
|