File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -510,7 +510,7 @@ public function setHome(int $stationId): JsonResponse {
510
510
public function getTrainStationAutocomplete (string $ query ): JsonResponse {
511
511
try {
512
512
$ trainAutocompleteResponse = (new StationController ())->search ($ query );
513
- return $ this ->sendResponse ($ trainAutocompleteResponse );
513
+ return $ this ->sendResponse (StationResource:: collection ( $ trainAutocompleteResponse) );
514
514
} catch (HafasException $ e ) {
515
515
// check if app is in debug mode
516
516
return $ this ->sendError (
Original file line number Diff line number Diff line change 6
6
use App \Exceptions \HafasException ;
7
7
use App \Exceptions \Wikidata \FetchException ;
8
8
use App \Http \Controllers \Controller ;
9
+ use App \Http \Resources \StationResource ;
9
10
use App \Models \Station ;
10
11
use App \Objects \LineSegment ;
11
12
use App \Services \StationService ;
@@ -106,7 +107,7 @@ public function TrainAutocomplete(string $station): JsonResponse {
106
107
try {
107
108
$ provider = new \App \Http \Controllers \Backend \Transport \StationController ();
108
109
$ trainAutocompleteResponse = $ provider ->search ($ station );
109
- return response ()->json ($ trainAutocompleteResponse );
110
+ return response ()->json (StationResource:: collection ( $ trainAutocompleteResponse) );
110
111
} catch (HafasException $ e ) {
111
112
abort (503 , $ e ->getMessage ());
112
113
}
Original file line number Diff line number Diff line change 3
3
namespace App \Http \Controllers ;
4
4
5
5
use App \Http \Controllers \Backend \Transport \StationController ;
6
+ use App \Http \Resources \StationResource ;
6
7
use Exception ;
7
8
use Illuminate \Http \JsonResponse ;
8
9
11
12
*/
12
13
class FrontendTransportController extends Controller
13
14
{
14
- public function TrainAutocomplete (string $ station ): JsonResponse
15
- {
15
+ public function TrainAutocomplete (string $ station ): JsonResponse {
16
16
try {
17
17
//todo: adapt data provider to users preferences
18
- $ provider = new StationController ();
18
+ $ provider = new StationController ();
19
19
$ trainAutocompleteResponse = $ provider ->search ($ station , 'de ' );
20
- return response ()->json ($ trainAutocompleteResponse );
20
+ return response ()->json (StationResource:: collection ( $ trainAutocompleteResponse) );
21
21
} catch (Exception $ e ) {
22
22
abort (503 , $ e ->getMessage ());
23
23
}
You can’t perform that action at this time.
0 commit comments