Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add resource missing option
  • Loading branch information
zholzhas committed Mar 11, 2021
commit c887875c23f393e3443b1fd2a8dd0c748e6f13ea
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