public function delete(Group $groupId, Post $postId)
    {
        $postId->delete();

        return response()->json(null, 204);
    }

路由:

$route->delete('/groups/{groupId}/posts/{postId}', Admin\GroupPostController::class.'@delete');

注意: 注入的对象一定要和路由参数一样才会生效($postId 路由参数就必须是postId)

相关文章:

猜你喜欢
  • 2022-03-04
  • 2021-09-12
  • 2022-12-23
  • 2021-11-02
相关资源
相似解决方案