laravel-find-unused-code icon indicating copy to clipboard operation
laravel-find-unused-code copied to clipboard

Undefined index: Controller

Open peterjthomson opened this issue 5 years ago • 2 comments

Line 86:

\Log::info('Ignoring route : ' . $route->getAction()['controller']);

Throws an error: Undefined index: controller.

Fix that worked for me: Remove the $route->getAction()['controller'] and just spit out 'Ignoring route'.

peterjthomson avatar May 10 '20 02:05 peterjthomson

Oh - do you know which route was causing the issue in your code? Was it a closure by any chance?

ohnotnow avatar May 10 '20 12:05 ohnotnow

I got the same error. It was a closure for me.

Fixed it with:

if (empty($route->getAction()['controller']) || !str_contains($route->getAction()['controller'], 'App')) {

kw-pr avatar Mar 08 '23 20:03 kw-pr