Add past trip view
This commit is contained in:
parent
a75d45b03f
commit
7793a01828
6 changed files with 193 additions and 4 deletions
|
@ -15,16 +15,40 @@ use GuzzleHttp\Client;
|
|||
*/
|
||||
|
||||
Route::get('/', function () {
|
||||
if (config('app.current_trip_id')) {
|
||||
$client = new Client([
|
||||
'base_uri' => 'https://app.wayward.travel/',
|
||||
'timeout' => 3.0
|
||||
]);
|
||||
|
||||
$response = $client->get('trip/'.config('app.current_trip_id').'/user/zmld8ko6qy7d9j3xvq10/json');
|
||||
|
||||
if ($response->getStatusCode() == 200) {
|
||||
$data = json_decode($response->getBody());
|
||||
return view('tracker', ['trip' => $data->trip]);
|
||||
} else {
|
||||
return 'Something went wrong';
|
||||
}
|
||||
} else {
|
||||
return view('no-trip');
|
||||
}
|
||||
});
|
||||
|
||||
Route::get('/past-trips', function () {
|
||||
return view('past-trips');
|
||||
});
|
||||
|
||||
Route::get('/past-trip/{tripId}', function ($tripId) {
|
||||
$client = new Client([
|
||||
'base_uri' => 'https://app.wayward.travel/',
|
||||
'timeout' => 3.0
|
||||
]);
|
||||
|
||||
$response = $client->get('trip/'.config('app.trip').'/user/zmld8ko6qy7d9j3xvq10/json');
|
||||
$response = $client->get('trip/'.$tripId.'/user/zmld8ko6qy7d9j3xvq10/json');
|
||||
|
||||
if ($response->getStatusCode() == 200) {
|
||||
$data = json_decode($response->getBody());
|
||||
return view('tracker', ['trip' => $data->trip]);
|
||||
return view('past-trip', ['trip' => $data->trip]);
|
||||
} else {
|
||||
return 'Something went wrong';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue