whereAll('category_id', $catId); } public function featured(int $limit = 6): array { // V0.9.1:改用 whereLimit('status',1,$limit),MySQL 下走带 LIMIT 的索引查询, // 不再 SELECT * 全表拉回再 array_filter(原写法每次请求都全表扫描)。 return $this->whereLimit('status', 1, $limit); } public function specsArray($p): array { $s = $p['specs'] ?? ''; if (is_array($s)) return $s; $dec = json_decode((string)$s, true); return is_array($dec) ? $dec : []; } public function galleryArray($p): array { $g = $p['gallery'] ?? ''; if (is_array($g)) return $g; $dec = json_decode((string)$g, true); return is_array($dec) ? $g : []; } }