优化范围查询
This commit is contained in:
parent
d873ba10f9
commit
f18766c20a
@ -23,7 +23,7 @@ trait ScopeTrait
|
||||
*/
|
||||
public function scopeCreator($query)
|
||||
{
|
||||
if (in_array('creator_id', $this->field)) {
|
||||
if (property_exists($this, 'field') && in_array('creator_id', $this->field)) {
|
||||
return $query->addSelectSub(function () {
|
||||
$user = app(Users::class);
|
||||
return $user->whereColumn($this->getTable() . '.creator_id', $user->getTable() . '.id')
|
||||
|
Loading…
x
Reference in New Issue
Block a user