$BrandList = \addons\shop\model\Brand::all();
//dump($BrandList);
foreach ($BrandList as $key => $item) {
$query = array_merge($params, ['brand_id' => $item->id]);
$item->url = $category['url'] . (stripos($category['url'], '?') !== false ? '&' : '?') . http_build_query($query);
}
$BrandList =Collection($BrandList)->toArray();
$params["brand_id"]="";
array_unshift($BrandList, ['id'=>"",'url' => $category['url'] . (stripos($category['url'], '?') !== false ? '&' : '?') . http_build_query($params),"name"=>"全部"]);
快捷键:ldsx
源:
sublime_text格式
<snippet>
<content><![CDATA[
\$BrandList = \addons\shop\model\Brand::all();
//dump(\$BrandList);
foreach (\$BrandList as \$key => \$item) {
\$query = array_merge(\$params, ['brand_id' => \$item->id]);
\$item->url = \$category['url'] . (stripos(\$category['url'], '?') !== false ? '&' : '?') . http_build_query(\$query);
}
\$BrandList =Collection(\$BrandList)->toArray();
\$params["brand_id"]="";
array_unshift(\$BrandList, ['id'=>"",'url' => \$category['url'] . (stripos(\$category['url'], '?') !== false ? '&' : '?') . http_build_query(\$params),"name"=>"全部"]);
]]></content>
<tabTrigger>ldsx(联动筛选加参数)</tabTrigger>
<scope></scope>
</snippet>
发表评论 取消回复