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.
revised the initial page and added facility directory
- Loading branch information
1 parent
f34a318
commit 598f215
Showing
7 changed files
with
412 additions
and
100 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.