我有以下两个集合:
Collection {#402 ?
#items: array:1 [?
4007 => "4007 - Container Deposit - 18.00 Drum - In Stock: 0.00"
]
}
Collection {#398 ?
#items: array:3 [?
1000 => "1000 - Acetone - 162.00 KG - In Stock: 10000.00"
1001 => "1001 - Acetone - 15.80 KG - In Stock: 0.00"
24662 => "24662 - 1L Untd Antifreeze Orange FO2272A60(Prem - 1.00 Litre - In Stock: 0.00"
]
}
Run Code Online (Sandbox Code Playgroud)
使用Laravel的集合合并功能:
$merged = $ref_prod_containers->merge($ref_cust_prod);
dd($merged);
Run Code Online (Sandbox Code Playgroud)
我得到以下内容:
Collection {#397 ?
#items: …Run Code Online (Sandbox Code Playgroud) 我正在努力解决JavaScript/jQuery问题.我正在开发基础4.我有一组5个按钮.其中两个按钮是下拉按钮.按下下拉按钮时,会显示一个窗口,其中包含下拉选项(链接).
<a id="products" href="#" data-dropdown="prod" class="not_active_button_dropdown">Dropdown Button</a><br>
<ul id="prod" class="f-dropdown">
<li><a class="prod" href="index.php?info=basic">Basic</a></li>
<li><a class="prod" href="index.php?info=unifrost">Unifrost</a></li>
<li><a class="prod" href="index.php?info=teal">Teal-Sorb</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
注意:我用mixin(class="not_active_button_dropdown")创建了自己的按钮类.
现在我开发了一个脚本,将php响应加载到div中#dropdownwrap,更改按钮,使其突出显示已按下的当前按钮.
<script style="text/javascript">
$(document).on('click','a.not_active_button, a.prod', function(){
var href=$(this).attr('href');
var querystring=href.slice(href.indexOf('?')+1);
//get
$.get('index_jq.php', querystring, processResponse).error(errorResponse);
//reset all buttons to not active
//normal button
$('a.active_button').removeClass("active_button").addClass("not_active_button");
//dropdown button
$('a.active_button_dropdown').removeClass("active_button_dropdown").addClass("not_active_button_dropdown");
//if it is a normal button make it active
if ($(this).hasClass("not_active_button"))
{
$(this).addClass("active_button");
}
//if it is a dropdown button option link make it active
if ($(this).hasClass("prod")) …Run Code Online (Sandbox Code Playgroud)