forked from mHealthKenya/ushauri_dashboard
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from palladiumkenya/main
Release of Ushauri Dashboards
- Loading branch information
Showing
23 changed files
with
1,601 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Http; | ||
|
||
class DirectoryController extends Controller | ||
{ | ||
public function directory(Request $request, $facility) | ||
{ | ||
$mfl = implode('', range(0, 9)); | ||
|
||
$apiUrl = env('ART_URL') . "directory/{$mfl}/{$facility}"; | ||
|
||
$response = Http::get($apiUrl); | ||
|
||
if ($response->successful()) { | ||
|
||
$apiData = $response->json(); | ||
return response()->json($apiData); | ||
} else { | ||
|
||
$errorData = $response->json(); | ||
return response()->json(['error' => 'API request failed'], $response->status()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.