36 lines
888 B
PHP
36 lines
888 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Services\CortexXdrService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
class CortexXdrController extends Controller
|
|
{
|
|
protected $cortex;
|
|
|
|
public function __construct(CortexXdrService $cortex)
|
|
{
|
|
$this->cortex = $cortex;
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
// Return view effectively immediately with a loading state
|
|
return view('cortex.index');
|
|
}
|
|
|
|
public function getData(CortexXdrService $cortexService)
|
|
{
|
|
try {
|
|
$summary = Cache::remember('cortex_summary_data', 300, function () use ($cortexService) {
|
|
return $cortexService->getSummary();
|
|
});
|
|
return response()->json($summary);
|
|
} catch (\Exception $e) {
|
|
return response()->json(['error' => $e->getMessage()], 500);
|
|
}
|
|
}
|
|
}
|