Revize a139ba77
Přidáno uživatelem Cajova-Houba před asi 7 roky(ů)
backend/app/Http/Controllers/DeviceController.php | ||
---|---|---|
26 | 26 |
$showDirection = ($request->input('showDirection') === 1); |
27 | 27 |
} |
28 | 28 |
|
29 |
return Zarizeni::findByAddressJoinAddress($address); |
|
29 |
$device = Zarizeni::findByAddressJoinAddress($address); |
|
30 |
if ($device == null || count($device) == 0) { |
|
31 |
return response('Not found.', 404); |
|
32 |
} |
|
33 |
|
|
34 |
return $device; |
|
30 | 35 |
} |
31 | 36 |
|
32 | 37 |
/** |
... | ... | |
70 | 75 |
$device = Zarizeni::findByIdJoinAddress($id); |
71 | 76 |
if ($device != null) { |
72 | 77 |
$device[0]->traffic = Zaznam::findByDevice($id, $dateFrom, $dateTo, $timeFrom, $timeTo, $direction); |
78 |
} else if ($device == null || count($device) == 0) { |
|
79 |
return response('Not found.', 404); |
|
73 | 80 |
} |
74 | 81 |
|
75 | 82 |
return $device; |
backend/app/Http/Controllers/LocationController.php | ||
---|---|---|
18 | 18 |
* Vrati vsechna mesta. |
19 | 19 |
*/ |
20 | 20 |
public function getCities() { |
21 |
return Mesto::with('zarizeni')->get(); |
|
21 |
$towns = Mesto::with('zarizeni')->get(); |
|
22 |
|
|
23 |
if ($towns == null || count($towns) == 0) { |
|
24 |
return response('Not fonud.', 404); |
|
25 |
} |
|
26 |
|
|
27 |
return $towns; |
|
22 | 28 |
} |
23 | 29 |
} |
backend/app/Http/Controllers/VehicleController.php | ||
---|---|---|
18 | 18 |
* Vrati vsechny typy vozidel. |
19 | 19 |
*/ |
20 | 20 |
public function getAll() { |
21 |
return Vozidlo::all(); |
|
21 |
$vehicles = Vozidlo::all(); |
|
22 |
|
|
23 |
if ($vehicles == null || count($vehicles) == 0) { |
|
24 |
return response('Not found.', 404); |
|
25 |
} |
|
26 |
|
|
27 |
return $vehicles; |
|
22 | 28 |
} |
23 | 29 |
} |
Také k dispozici: Unified diff
refs #6699: Pridany chybove kody k rest api end pointum.