-
app/Repositories/DashboardRepository.php
Open in GitHubuse App\Models\Space; class DashboardRepository { public function getBalance(string $year, string $month) { return Space::find(session('space_id'))->monthlyBalance($year, $month); } // }
-
app/Widgets/Balance.php
Open in GitHubuse App\Repositories\DashboardRepository; class Balance { private $dashboardRepository; public function __construct() { $this->dashboardRepository = new DashboardRepository(); } public function render() { // $balance = $this->dashboardRepository->getBalance(date('Y'), date('n')); // } }