我读了一个表以建立一个列表框
$compets = DB::table('compets')->select('id','com_l_compet')
->where('com_c_st','<>','I')
->orderby('com_n_ord_aff')
->get();
我想在列表“所有竞争”的开头添加一个选择。因此选择此选择将重新初始化过滤器。我该怎么做?我使用了数组函数,但是$ compets是一个对象...前置不起作用...我阅读了一些回复和文档,但没有找到简单的解决方案请你能帮忙吗?您知道在哪里可以找到完整的示例,以查看包含过滤器管理+带联接的查询+分页的视图吗?非常感谢
您可以将$ compets转换为“ array”,也可以使用“ prepend”函数添加一个开始于集合的项目。
$compets = DB::table('compets')->select('id','com_l_compet')
->where('com_c_st','<>','I')
->orderby('com_n_ord_aff')
->get()->toArray;
... enter adding item
或
$compets = DB::table('compets')->select('id','com_l_compet')
->where('com_c_st','<>','I')
->orderby('com_n_ord_aff')
->get();
... $compets->prepend("All Compets");