$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>
点赞(0)

评论列表 共有 0 条评论

暂无评论
立即
投稿
发表
评论
返回
顶部