我在用

return response(null,204);

because I would like to return an empty body message, but the problem is that when I parse the response with a ruby code

JSON.parse(res.body)

我得到一些身体信息:

{"data"=>[]}

so how can I avoid to return this "data" and instead return only the status code?

推荐答案

try return Response::make("", 204);

Update: Mark's answer is more up to date:

return response()->noContent()

Laravel相关问答推荐

为什么在Blade 文件中输出用户通知时出现错误?

为什么只删除了最后一个Like,而没有删除选中的?

Livewire 3分页在点击后不更新页面

如何获取多态多对多关系子查询的自动 id 列名?

使用Laravel Blade Formatter和PHP Intelephense进行 VSCode 格式化

"public/index.php" 可以在 laravel 中按组写入

找不到列:1054字段列表中的未知列0-Laravel-我的代码中的任何地方都没有0列

Laravel 使用 Storage::put 生成唯一 ID

删除表后如何重新迁移laravel迁移

Laravel - 批量分配异常错误

Laravel 随机排序

Laravel 5:完整性约束违规:1452 无法添加或更新子行:外键约束失败

Laravel 在特定文件夹中创建迁移文件

Eloquent - 更新集合中的所有模型

如何在 Laravel 4 中使用 SHA1 加密而不是 BCrypt?

在 Laravel 中,如何获取 *only* POST 参数?

Laravel 迁移 - 删除列

Laravel 4:将什么作为参数传递给 Url 类?

Laravel 在域和子域中共享 cookie 检测问题

[Vue 警告]:找不到元素:#app