I am listing the data of a query I made with the following code:
$users = DB::table('users')
->join('transportes', 'users.id', '=', 'transportes.user_id')
->join('empresas', 'transportes.id', '=', 'empresas.transporte_id')
->join('motoristas', 'transportes.id', '=', 'motoristas.transporte_id')
->join('caminhoes', 'motoristas.id', '=', 'caminhoes.motorista_id')
->select('caminhoes.cavalo', 'caminhoes.carreta', 'transportes.data_registro')
->whereBetween('transportes.data_registro',['2017-01-01 03:02:46','2018-03-12 11:59:25'])
->get();
And the following result is coming out:
object (Illuminate \ Support \ Collection) # 206 (1) {["items": protected] = > array (15) {[0] = > object (stdClass) # 213 (3) {["horse"] = > string (7) "AAA-221" ["cart"] = > string (7) "BBB-196" ["record_data"] = > string (19) "2018-03-06 22:41:07"} [1] = > object (stdClass) # 209 (3) { ["horse"] = > string (7) "AAA-221" ["cart"] = > string (7) "BBB-196" ["record_data"] = > string (19) "2018-03-06 22:41:07"} [2] = > object (stdClass) # 212 (3) {["horse"] = > string (7) "AAA-221" ["cart"] = > string (7) "BBB-196" ["record_data"] = > string (19) "2018-03-06 22:41:07"} [3] = > object (stdClass) # 215 (3) {["horse"] = > string (7) "AAA-489" ["cart"] = > string (7) "BBB-213" ["record_data"] = > string (19) "2018-02-27 01:52:54"} [4] = > object (stdClass) # 208 (3) {["horse"] = > string (7) "AAA-489" ["cart"] = > string (7) "BBB-213" ["data_registration"] = > string (19) "2018-02-27 01:52:54"} [5] = > object (stdClass) # 207 (3) {["horse"] = > string (7) "AAA-388" ["cart"] = > string (7) "BBB-309" ["record_data"] = > string (19) "2018-02-27 01:52:54"} [6] = > object (stdClass) # 210 (3) {["horse"] = > string (7) "AAA-388" ["cart"] = > string (7) "BBB-309" ["record_name"] = > string (19) "2018-02-27 01:52:54"} [7] = > object (stdClass) # 216 (3) {["horse"] = > string (7) "AAA-448" ["cart"] = > string (7) "BBB-209" ["record_data"] = > string (19) "2018-02-27 01:52:54"} [8] = > object (stdClass) # 217 (3) {["horse"] = > string (7) "AAA-448" ["cart"] = > string (7) "BBB-209" ["record_data"] = > string (19) "2018-02-27 01:52:54"} [9] = > object (stdClass) # 218 (3) {["horse"] = > string (7) "AAA-401" ["cart"] = > string (7) "BBB-271" ["record_data"] = > string (19) "2018-02-27 01:52:54"} [10] = > object (stdClass) # 219 (3) {["horse"] = > string (7) "AAA-401" ["cart"] = > string (7) "BBB-271" ["data_registration"] = > string (19) "2018-02-27 01:52:54"} [11] = > object (stdClass) # 220 (3) {["horse"] = > string (7) "AAA-187" ["cart"] = > string (7) "BBB-422" ["record_data"] = > string (19) "2018-02-27 01:52:54"} [12] = > object (stdClass) # 221 (3) {["horse"] = > string (7) "AAA-187" ["cart"] = > string (7) "BBB-422" ["record_data"] = > string (19) "2018-02-27 01:52:54"} [13] = > object (stdClass) # 222 (3) {["horse"] = > string (7) "AAA-276" ["cart"] = > string (7) "BBB-438" ["record_data"] = > string (19) "2017-12-18 20:35:44"} [14] = > object (stdClass) # 223 (3) {["horse"] = > string (7) "AAA-276" ["cart"] = > string (7) "BBB-438" ["record_time"] = > string (19) "2017-12-18 20:35:44"}}}
I wish I could get the data separated. Example: just pick up the 'horses' column and list?