我有两个 Laravel 集合。第一个集合 $customer(它有 30 个元素):
Collection {#2615 ?
#items: array:31 [?
0 => {#2610 ?
+"allocated_date": "2016-12-01"
+"Customer": "44"
}
1 => {#2616 ?
+"allocated_date": "2016-12-02"
+"Customer": "42"
}
Run Code Online (Sandbox Code Playgroud)
另一个是 $agent(它有 17 个元素)
Collection {#2586 ?
#items: array:16 [?
0 => {#2585 ?
+"agent_allocated_date": "2016-12-01"
+"Agent": "41"
}
1 => {#2587 ?
+"agent_allocated_date": "2016-12-02"
+"Agent": "95"
}
Run Code Online (Sandbox Code Playgroud)
我需要这样的结果(leftJoinlocated_date 和 agent_allocated_date)。不能使用合并或组合。因为两个集合中的元素数量不同。帮我找到输出
array:31 [?
0 => {#2596 ?
+"allocated_date": "2016-12-01"
+"Customer": "44"
+"agent_allocated_date": "2016-12-01"
+"Agent": "41"
}
Run Code Online (Sandbox Code Playgroud)