Skip to content

Commit

Permalink
fix: patch up resource doc inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Dec 6, 2024
1 parent 6d7069d commit 5187459
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

/**
Expand Down

0 comments on commit 5187459

Please sign in to comment.