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)