*/ public function schema(JsonSchema $schema): array { return [ 'from' => $schema->string()->description('Start date, YYYY-MM-DD.')->required(), 'to' => $schema->string()->description('End date, YYYY-MM-DD.')->required(), ]; } protected function respond(Request $request, User $user): Response { $request->validate([ 'from' => ['required', 'date'], 'to' => ['required', 'date'], ]); $controller = app(CashflowAnalyticsController::class); $range = ['from' => $request->string('from')->toString(), 'to' => $request->string('to')->toString()]; return $this->json([ 'summary' => $this->callController($controller, 'summary', $user, $range), 'sankey' => $this->callController($controller, 'sankey', $user, $range), 'trend' => $this->callController($controller, 'trend', $user, $range), ]); } }