Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12a55a8

Browse files
committed
Merge pull request laravel#8407 from rkgrep/patch-registrar
[5.0] Allow custom resource registrar injection
2 parents 5f4cd97 + 5fe8ab3 commit 12a55a8

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/Illuminate/Routing/Router.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,16 @@ public function resources(array $resources)
323323
*/
324324
public function resource($name, $controller, array $options = array())
325325
{
326-
(new ResourceRegistrar($this))->register($name, $controller, $options);
326+
if ($this->container && $this->container->bound('Illuminate\Routing\ResourceRegistrar'))
327+
{
328+
$registrar = $this->container->make('Illuminate\Routing\ResourceRegistrar');
329+
}
330+
else
331+
{
332+
$registrar = new ResourceRegistrar($this);
333+
}
334+
335+
$registrar->register($name, $controller, $options);
327336
}
328337

329338
/**

0 commit comments

Comments
 (0)