restore controller section of autoloader.

This commit is contained in:
Taylor Otwell 2011-11-09 22:38:29 -06:00
parent 8718b582df
commit fe218f9b0b
2 changed files with 14 additions and 18 deletions

View File

@ -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;
}
}
}
}

View File

@ -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 {
/**