From 5187459ad32639e6c8ad5000a48cbbdea738e898 Mon Sep 17 00:00:00 2001 From: mychidarko Date: Fri, 6 Dec 2024 15:20:04 +0000 Subject: [PATCH] fix: patch up resource doc inconsistencies --- src/Router.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Router.php b/src/Router.php index 56a97ee..91e788e 100644 --- a/src/Router.php +++ b/src/Router.php @@ -356,10 +356,14 @@ public static function resource(string $pattern, $controller) static::match('GET|HEAD', $pattern, "$controller@index"); static::post($pattern, "$controller@store"); static::match('GET|HEAD', "$pattern/create", "$controller@create"); - static::match('POST|DELETE', "$pattern/{id}/delete", "$controller@destroy"); - static::match('POST|PUT|PATCH', "$pattern/{id}/edit", "$controller@update"); + static::match('DELETE', "$pattern/{id}", "$controller@destroy"); + static::match('PUT|PATCH', "$pattern/{id}", "$controller@update"); static::match('GET|HEAD', "$pattern/{id}/edit", "$controller@edit"); static::match('GET|HEAD', "$pattern/{id}", "$controller@show"); + + // still keeping DELETE and PUT|PATCH so earlier versions of leaf apps don't break + static::match('POST|DELETE', "$pattern/{id}/delete", "$controller@destroy"); + static::match('POST|PUT|PATCH', "$pattern/{id}/edit", "$controller@update"); } /**