where('language_id', '=', $value); } // 根据问题搜索 public function searchQuestionAttr($query, $value, $data) { if (is_null($value)) { return; } $query->where('question', 'like', "%$value%"); } // 根据添加时间搜索 public function searchCreatedAtAttr($query, $value, $data) { if (is_null($value)) { return; } if (is_array($value)) { if (count($value) > 1) { $query->whereBetweenTime('created_at', $value[0], $value[1]); } else { $query->whereTime('created_at', '>=', $value[0]); } } } }