api = $api; } /** * @param ApiService $api * @return Factory|View|Application|\Illuminate\View\View|object * @throws ConnectionException */ public function index(ApiService $api) { $response = $api->withAuth()->get('/employee/me'); $user = $response->json(); $statsResponse = $api->withAuth()->get('/employee/statistics'); $stats = $statsResponse->json(); return view('dashboard', [ 'user' => $user, 'stats' => $stats ]); } }