feat: automatically populate past trips list
This commit is contained in:
parent
6d716a242b
commit
fb5b0347fb
2 changed files with 21 additions and 4 deletions
|
@ -21,7 +21,23 @@ class TrackerController extends Controller
|
|||
*/
|
||||
public function show_past_trips_list()
|
||||
{
|
||||
return view('past-trips');
|
||||
$trips = [];
|
||||
|
||||
foreach (config('app.past_trip_ids') as $tripId) {
|
||||
$tripData = $this->get_trip_data($tripId, false);
|
||||
$trips[$tripId] = [
|
||||
'name' => $tripData->name,
|
||||
'start_date' => new DateTime($tripData->date_start),
|
||||
'end_date' => new DateTime($tripData->date_end)
|
||||
];
|
||||
}
|
||||
|
||||
return view(
|
||||
'past-trips',
|
||||
[
|
||||
'trips' => $trips
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue