Skip to content

Commit

Permalink
Add resource missing option
Browse files Browse the repository at this point in the history
  • Loading branch information
zholzhas committed Mar 11, 2021
1 parent 62925b6 commit c887875
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Illuminate/Routing/ResourceRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ class ResourceRegistrar
*/
protected $resourceDefaults = ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy'];

/**
* Actions that use model binding.
*
* @var string[]
*/
protected $modelBoundMethods = ['show', 'edit', 'update', 'destroy'];

/**
* The parameters set for this resource instance.
*
Expand Down Expand Up @@ -191,6 +184,8 @@ protected function addResourceIndex($name, $base, $controller, $options)
{
$uri = $this->getResourceUri($name);

unset($options['missing']);

$action = $this->getResourceAction($name, $controller, 'index', $options);

return $this->router->get($uri, $action);
Expand All @@ -209,6 +204,8 @@ protected function addResourceCreate($name, $base, $controller, $options)
{
$uri = $this->getResourceUri($name).'/'.static::$verbs['create'];

unset($options['missing']);

$action = $this->getResourceAction($name, $controller, 'create', $options);

return $this->router->get($uri, $action);
Expand All @@ -227,6 +224,8 @@ protected function addResourceStore($name, $base, $controller, $options)
{
$uri = $this->getResourceUri($name);

unset($options['missing']);

$action = $this->getResourceAction($name, $controller, 'store', $options);

return $this->router->post($uri, $action);
Expand Down Expand Up @@ -428,7 +427,7 @@ protected function getResourceAction($resource, $controller, $method, $options)
$action['where'] = $options['wheres'];
}

if (isset($options['missing']) && in_array($method, $this->modelBoundMethods)) {
if (isset($options['missing'])) {
$action['missing'] = $options['missing'];
}

Expand Down

0 comments on commit c887875

Please sign in to comment.