Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Laravel Reverb Live Dashboard

When building a dashboard with Financial information - it's nice to have it updated in real-time. So let's use Laravel Reverb to update a table and a few of our charts.

All the data to the dashboard comes from a DashboardController Controller.

app/Http/Controllers/DashboardController.php:

use Illuminate\View\View;
use App\Services\OrdersService;
 
class DashboardController extends Controller
{
public function __invoke(OrdersService $ordersService): View
{
$totalRevenue = $ordersService->getTotalRevenue();
$thisMonthRevenue = $ordersService->getThisMonthRevenue();
$todayRevenue = $ordersService->getTodayRevenue();
$latestOrders = $ordersService->getLatestOrders(5);
$orderChartByMonth = $ordersService->orderChartByMonth();
$orderChartByDay = $ordersService->orderChartByDay();
 
return view(
'dashboard',
compact(
'totalRevenue',
'thisMonthRevenue',
'todayRevenue',
'latestOrders',
'orderChartByDay',
'orderChartByMonth'
)
);
}
}

Calculations for the data are made using the OrdersService service.

app/Services/OrdersService.php:

use App\Models\Order;
use Illuminate\Database\Eloquent\Collection;
 
class OrdersService
{
public function getTotalRevenue(): float|int
{
return Order::query()
->pluck('total')
->sum() / 100;
}
// ....

In this example, you will see:

  • Service usage to retrieve the data
  • Laravel Reverb usage to update the dashboard in real-time

Want to Get Access to GitHub Repository?

Unlock the complete README, installation instructions, code walkthrough, and direct access to clone the repository. Join our premium membership to access all project examples.

Full Source Code
Clone and customize
Documentation
Complete setup guides
All Examples
15 premium projects
Become a Premium Member for $129/year or $29/month

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.