*/ public function schema(JsonSchema $schema): array { return [ 'space' => $schema->string()->description('Space id to query. Defaults to the personal space.'), ]; } protected function respond(Request $request, User $user): Response { $space = $this->resolveSpace($request, $user); $labels = Label::query() ->forSpace($space) ->orderBy('name') ->get() ->map(fn (Label $label): array => [ 'id' => $label->id, 'name' => $label->name, 'color' => $label->color, ]); return $this->json([ 'space_id' => $space->id, 'labels' => $labels, ]); } }