我有一个带有多个联合表的Laravel函数。因此,在刀片服务器中,我可以将所有联合表导出到单个html表中。 我正在寻找一个选项来过滤表显示的数据。 (选择仅显示相对于特定表的数据)。我们该怎么做?
我的控制器代码。
$table1 = Invoice::where('validate','=','1')
->whereBetween('updated_at', [$date1, $date2])
->union($table2)
->union($table3)
->union($table4)
->orderBy('updated_at', 'DESC')
->get();
我的观点:
@foreach($table1 as $table)
{{$table->id}}
@endforeach
在示例中,我希望在html表中仅显示与$table3
相关的数据。谢谢