authorizeCurrentWorkspace( $request, 'createPost', 'Not authorized to manage labels.', ); if (! $workspace instanceof Workspace) { return $workspace; } $validated = $request->validate(['label_id' => ['required', 'string']]); $label = WorkspaceLabel::where('workspace_id', $workspace->id) ->find(data_get($validated, 'label_id')); if (! $label) { return Response::error('Label not found.'); } DeleteLabel::execute($label); return Response::structured(['deleted' => true]); } public function schema(JsonSchema $schema): array { return [ 'label_id' => $schema->string()->required()->description('The label ID to delete.'), ]; } }