model = $model; } public function byAreaIdGetAns($area_id) { $area_ids = array_unique([0, $area_id]); return $this->model ->whereIn('area_id', $area_ids) ->where('status', Announcement::STATUS_OK) ->orderByDesc('id') ->paginate(); } /** * 获取最后一条公告 * */ public function byAreaIdGetLastAn($area_id) { $area_ids = array_unique([0, $area_id]); return $this->model ->whereIn('area_id', $area_ids) ->where('status', Announcement::STATUS_OK) ->whereDate('expiration_time', '>', Carbon::now()) ->orderByDesc('id') ->first(); } }