Refactoring the dashboard
We are going to create a new route, /dashboard-concurrent-cached
, with the Octane route and we are going to call a new DashboardController
method, indexConcurrentCached()
:
// Importing Octane class use Laravel\Octane\Facades\Octane; // Importing Response class use Illuminate\Http\Response; // Importing the DashboardController class use App\Http\Controllers\DashboardController; Octane::route('GET', '/dashboard-concurrent-cached', function () { return new Response((new DashboardController)-> indexConcurrentCached()); });
In the controller app/Http/Controllers/DashboardController.php
file, you can add the new method:
public function indexConcurrentCached() { $time = hrtime(true); try { [$count,$eventsInfo,$eventsWarning,$eventsAlert] = ...