Add show-all-checkins route
This commit is contained in:
parent
6563a4b5e2
commit
f269b2cd8c
2 changed files with 30 additions and 7 deletions
|
@ -19,7 +19,7 @@ Route::get('/past-trips', function () {
|
|||
return view('past-trips');
|
||||
});
|
||||
|
||||
Route::get('/{tripId?}', function ($tripId = null) {
|
||||
Route::get('/{tripId?}/{showAll?}', function ($tripId = null, $showAll = false) {
|
||||
if (!$tripId && !config('app.current_trip_id')) return view('no-trip');
|
||||
|
||||
/*
|
||||
|
@ -32,7 +32,7 @@ Route::get('/{tripId?}', function ($tripId = null) {
|
|||
$cachedDataUpdatedAt = new DateTime($cachedData->trip->updated_at);
|
||||
$now = new DateTime();
|
||||
if (intval(($now->getTimestamp() - $cachedDataUpdatedAt->getTimestamp()) / 3600) <= 5) {
|
||||
return view('tracker', ['trip' => $cachedData->trip]);
|
||||
return view('tracker', ['trip' => $cachedData->trip, 'showAllCheckins' => ($showAll === 'all')]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ Route::get('/{tripId?}', function ($tripId = null) {
|
|||
}
|
||||
}
|
||||
|
||||
return view('tracker', ['trip' => $data->trip]);
|
||||
return view('tracker', ['trip' => $data->trip, 'showAllCheckins' => ($showAll === 'all')]);
|
||||
} else {
|
||||
return 'Something went wrong';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue