$current = Table::where('date', '2020-08-01')->get();
$last = Table::where('date', \Carbon\Carbon::parse('2020-08-01')->subYear(1)->format('Y-m-d))->get();
$result['current'] = $current;
$result['last'] = $last;
Return response()->json($result);
Array
(
[0] => Array
(
[id] => 5
[name] => Jake
[time] => 2
[pos] => 1
)
[1] => Array
(
[id] => 1
[name] => Mike
[time] => 4
[pos] => 2
)
[2] => Array
(
[id] => 2
[name] => Carissa
[time] => 5
[pos] => 3
)
[3] => Array
(
[id] => 3
[name] => Mathew
[time] => 5
[pos] => 3
)
[4] => Array
(
[id] => 4
[name] => Nike
[time] => 6
[pos] => 4
)
)
$details = array(
0 => array("id"=>1, "name"=>"Mike", "time" => 4),
1 => array("id"=>2, "name"=>"Carissa", "time" => 5 ),
2 => array("id"=>3, "name"=>"Mathew", "time" => 5),
3 => array("id"=>4, "name"=>"Nike", "time" => 6),
);
Array
(
[0] => Array
(
[id] => 1
[name] => Mike
[pos] => 1
)
[1] => Array
(
[id] => 2
[name] => Carissa
[pos] => 2
)
[2] => Array
(
[id] => 1
[name] => Mathew
[pos] => 2
)
[3] => Array
(
[id] => 3
[name] => Nike
[pos] => 3
)
)