From fe218f9b0b9763c37c44acbe07c1b1e42fea458a Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 9 Nov 2011 22:38:29 -0600 Subject: [PATCH] restore controller section of autoloader. --- laravel/autoloader.php | 14 ++++++++++++++ laravel/routing/controller.php | 18 ------------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/laravel/autoloader.php b/laravel/autoloader.php index 8bb8428a..65be66f1 100644 --- a/laravel/autoloader.php +++ b/laravel/autoloader.php @@ -86,6 +86,20 @@ protected static function find($class) return $path; } + + // Since not all controllers will be resolved by the controller resolver, + // we will do a quick check in the controller directory for the class. + // For instance, since base controllers would not be resolved by the + // controller class, we will need to resolve them here. + if (strpos($class, '_Controller') !== false) + { + $controller = str_replace(array('_Controller', '_'), array('', '/'), $class); + + if (file_exists($path = strtolower(CONTROLLER_PATH.$controller.EXT))) + { + return $path; + } + } } } \ No newline at end of file diff --git a/laravel/routing/controller.php b/laravel/routing/controller.php index 39130e93..065cc626 100644 --- a/laravel/routing/controller.php +++ b/laravel/routing/controller.php @@ -6,24 +6,6 @@ use Laravel\Redirect; use Laravel\Response; -/** - * Register a function on the autoload stack to lazy-load controller files. - * We register this function here to keep the primary autoloader smaller - * since this logic is not needed for every Laravel application. - */ -spl_autoload_register(function($controller) -{ - if (strpos($controller, '_Controller') !== false) - { - $controller = str_replace(array('_Controller', '_'), array('', '/'), $controller); - - if (file_exists($path = strtolower(CONTROLLER_PATH.$controller.EXT))) - { - return $path; - } - } -}); - abstract class Controller { /**