service_retrieve_data

This commit is contained in:
pcalengratha
2026-03-24 16:56:45 +07:00
parent 28bbb46165
commit 801f280ff9
9 changed files with 816 additions and 6 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Api;
use App\Services\DataRetrievalService;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Services\DashboardService;
@@ -10,10 +11,12 @@ use Carbon\Carbon;
class DashboardController extends Controller
{
protected $service;
protected $dataRetrievalService;
public function __construct(DashboardService $service)
{
$this->service = $service;
$this->dataRetrievalService = new DataRetrievalService();
}
/*
@@ -165,4 +168,17 @@ class DashboardController extends Controller
return response()->json($data);
}
}
public function fetchSourceData(){
try{
$this->dataRetrievalService->getSurveillanceData();
return response()->json(['message' => 'Data loaded successfully!'], 200);
}
catch (\Exception $e)
{
return response()->json(['error' => 'Data loaded unsuccessfully!'], 400);
}
}
}