refactor
- move elixForms API logic to specific folder - move everything else under Api folder
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace Controllers;
|
||||
|
||||
use Core\Request;
|
||||
use Core\Response;
|
||||
use ElixForms\ElixFormsClient;
|
||||
|
||||
class ExampleController
|
||||
{
|
||||
private ElixFormsClient $elixFormsClient;
|
||||
|
||||
public function __construct(ElixFormsClient $elixFormsClient)
|
||||
{
|
||||
$this->elixFormsClient = $elixFormsClient;
|
||||
}
|
||||
|
||||
public function test(Request $req, Response $res)
|
||||
{
|
||||
$response = $this->elixFormsClient->request('GET', '/status');
|
||||
|
||||
return $res->json([
|
||||
'external_api_response' => $response['json'] ?? $response['body'],
|
||||
'status' => $response['status']
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user