privilegeService = $privilegeService; $this->postService = $postService; } public function getMethods() { return ['DELETE']; } public function getUrl() { return '/api/posts/:postNameOrId'; } public function work() { $this->privilegeService->assertPrivilege(Privilege::DELETE_POSTS); $post = $this->postService->getByNameOrId($this->getArgument('postNameOrId')); $this->postService->deletePost($post); } }