Skip to content

Commit 5187459

Browse files
committed
fix: patch up resource doc inconsistencies
1 parent 6d7069d commit 5187459

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Router.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,14 @@ public static function resource(string $pattern, $controller)
356356
static::match('GET|HEAD', $pattern, "$controller@index");
357357
static::post($pattern, "$controller@store");
358358
static::match('GET|HEAD', "$pattern/create", "$controller@create");
359-
static::match('POST|DELETE', "$pattern/{id}/delete", "$controller@destroy");
360-
static::match('POST|PUT|PATCH', "$pattern/{id}/edit", "$controller@update");
359+
static::match('DELETE', "$pattern/{id}", "$controller@destroy");
360+
static::match('PUT|PATCH', "$pattern/{id}", "$controller@update");
361361
static::match('GET|HEAD', "$pattern/{id}/edit", "$controller@edit");
362362
static::match('GET|HEAD', "$pattern/{id}", "$controller@show");
363+
364+
// still keeping DELETE and PUT|PATCH so earlier versions of leaf apps don't break
365+
static::match('POST|DELETE', "$pattern/{id}/delete", "$controller@destroy");
366+
static::match('POST|PUT|PATCH', "$pattern/{id}/edit", "$controller@update");
363367
}
364368

365369
/**

0 commit comments

Comments
 (0)