where('status', ModelStatusEnum::OK)->where('type', '1')->orderByDesc('sort')->get(); $bannersS = []; foreach ($banners as $banner) { $bannersS[] = [ 'id' => $banner->id, 'image' => $banner->url ]; } //公告板最后两条数据 /** * 修改意见-mead * 固定ID,名称后台可以修改 已修改 */ $informations = Information::query()->where('status', ModelStatusEnum::OK)->where('type_id', TypeIdEnum::NOTICE)->orderByDesc('id')->limit(2)->get(); $informationsS = []; foreach ($informations as $information) { $informationsS[] = [ 'id' => $information->id, 'title' => $information->title, 'created_at' => $information->created_at->format('Y-m-d') ]; } return $this->response->success(compact('bannersS', 'informationsS')); } }