New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#2 Station search via device positioning services #79
Changes from 5 commits
fdcc9f9
8a117f2
92dedd8
9287960
3f64c21
4df0f05
3c95bf4
9422f84
c3b7caa
906a985
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,24 @@ public function TrainStationboard(Request $request) { | |
); | ||
} | ||
|
||
public function StationByCoordinates(Request $request) | ||
{ | ||
$request->validate([ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have to save the result from ->validate in an variable to use the validated input. for example: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, my bad. |
||
'latitude' => 'required|numeric|min:-180|max:180', | ||
'longitude' => 'required|numeric|min:-180|max:180' | ||
]); | ||
|
||
$NearestStation = TransportBackend::StationByCoordinates($request->latitude, $request->longitude); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recommend renaming the variable to "$nearestStation" |
||
if ($NearestStation === null) { | ||
return redirect()->back()->with('error', __('controller.transport.no-station-found')); | ||
} | ||
|
||
return redirect(route('trains.stationboard', [ | ||
'station' => $NearestStation['station']['name'], | ||
'provider' => 'train' | ||
])); | ||
} | ||
|
||
public function TrainTrip(Request $request) { | ||
$TrainTripResponse = TransportBackend::TrainTrip( | ||
$request->tripID, | ||
|
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,7 +169,7 @@ class="fas fa-tools"></i> {{__('menu.admin')}}</a> | |
<span class="footer-nav-link">/ <a href="{{ route('blog.all') }}">{{ __('menu.blog') }}</a></span> | ||
</p> | ||
<p class="mb-0">{!! __('menu.developed') !!}</p> | ||
<p class="mb-0">© 2019 Träwelling</p> | ||
<p class="mb-0">© 2020 Träwelling</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it would be better to change the year to {{date('Y')}} to prevent these changes. |
||
<p class="mb-0 text-muted small">commit: {{ get_current_git_commit() }}</p> | ||
</div> | ||
</footer> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,6 +256,11 @@ | |
'as' => 'trains.stationboard', | ||
]); | ||
|
||
Route::get('/trains/nearby', [ | ||
'uses' => 'FrontendTransportController@StationByCoordinates', | ||
'as' => 'trains.nearby', | ||
]); | ||
|
||
Comment on lines
+259
to
+263
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add an API request for this? Then we need to adjust the |
||
Route::get('/trains/trip', [ | ||
'uses' => 'FrontendTransportController@TrainTrip', | ||
'as' => 'trains.trip' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend renaming it "getStationByCoordinates", even if other method names are in this format. See my general answer to your pull request for further information.