Skip to content

Commit c887875

Browse files
committed
Add resource missing option
1 parent 62925b6 commit c887875

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/Illuminate/Routing/ResourceRegistrar.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ class ResourceRegistrar
2020
*/
2121
protected $resourceDefaults = ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy'];
2222

23-
/**
24-
* Actions that use model binding.
25-
*
26-
* @var string[]
27-
*/
28-
protected $modelBoundMethods = ['show', 'edit', 'update', 'destroy'];
29-
3023
/**
3124
* The parameters set for this resource instance.
3225
*
@@ -191,6 +184,8 @@ protected function addResourceIndex($name, $base, $controller, $options)
191184
{
192185
$uri = $this->getResourceUri($name);
193186

187+
unset($options['missing']);
188+
194189
$action = $this->getResourceAction($name, $controller, 'index', $options);
195190

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

207+
unset($options['missing']);
208+
212209
$action = $this->getResourceAction($name, $controller, 'create', $options);
213210

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

227+
unset($options['missing']);
228+
230229
$action = $this->getResourceAction($name, $controller, 'store', $options);
231230

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

431-
if (isset($options['missing']) && in_array($method, $this->modelBoundMethods)) {
430+
if (isset($options['missing'])) {
432431
$action['missing'] = $options['missing'];
433432
}
434433

0 commit comments

Comments
 (0)