'=', 'name' => 'like', 'title' => 'like', ]; public function model() { return Model::class; } /** * 查询条件 * * @return void */ public function withConditions(array $conditions = []) { if (isset($conditions['ids'])) { $this->model = $this->model->whereIn('id', $conditions['ids']); } if (isset($conditions['role_ids'])) { $this->model = $this->model->whereHas('roles', function ($query) use ($conditions) { $query->where('id', $conditions['role_ids']); }); } $this->model = $this->model->orderBy('displayorder', 'desc')->orderBy('id', 'asc'); return $this; } }