validate(['post_id' => ['required', 'string']]); $post = Post::where('workspace_id', $request->user()?->current_workspace_id) ->find(data_get($validated, 'post_id')); if (! $post) { return Response::error('Post not found.'); } if ($denied = $this->denyUnlessCan($request, 'delete', $post, 'Not authorized to delete this post.')) { return $denied; } DeletePost::execute($post); return Response::structured(['deleted' => true]); } public function schema(JsonSchema $schema): array { return [ 'post_id' => $schema->string()->required()->description('The post ID to delete.'), ]; } }