Browse Source

tweak how autoloader works.

Taylor Otwell 11 years ago
parent
commit
098c6c6295
3 changed files with 16 additions and 3 deletions
  1. 1 1
      app/config/app.php
  2. 2 2
      app/start/global.php
  3. 13 0
      bootstrap/autoload.php

+ 1 - 1
app/config/app.php

@@ -142,7 +142,7 @@ return array(
 		'Auth'            => 'Illuminate\Support\Facades\Auth',
 		'Auth'            => 'Illuminate\Support\Facades\Auth',
 		'Blade'           => 'Illuminate\Support\Facades\Blade',
 		'Blade'           => 'Illuminate\Support\Facades\Blade',
 		'Cache'           => 'Illuminate\Support\Facades\Cache',
 		'Cache'           => 'Illuminate\Support\Facades\Cache',
-		'ClassLoader'     => 'Illuminate\Foundation\ClassLoader',
+		'ClassLoader'     => 'Illuminate\Support\ClassLoader',
 		'Config'          => 'Illuminate\Support\Facades\Config',
 		'Config'          => 'Illuminate\Support\Facades\Config',
 		'Controller'      => 'Illuminate\Routing\Controllers\Controller',
 		'Controller'      => 'Illuminate\Routing\Controllers\Controller',
 		'Cookie'          => 'Illuminate\Support\Facades\Cookie',
 		'Cookie'          => 'Illuminate\Support\Facades\Cookie',

+ 2 - 2
app/start/global.php

@@ -11,12 +11,12 @@
 |
 |
 */
 */
 
 
-ClassLoader::register(new ClassLoader(array(
+ClassLoader::addDirectories(array(
 
 
 	app_path().'/controllers',
 	app_path().'/controllers',
 	app_path().'/models',
 	app_path().'/models',
 
 
-)));
+));
 
 
 /*
 /*
 |--------------------------------------------------------------------------
 |--------------------------------------------------------------------------

+ 13 - 0
bootstrap/autoload.php

@@ -14,6 +14,19 @@
 
 
 require __DIR__.'/../vendor/autoload.php';
 require __DIR__.'/../vendor/autoload.php';
 
 
+/*
+|--------------------------------------------------------------------------
+| Register The Laravel Auto Loader
+|--------------------------------------------------------------------------
+|
+| We register an auto-loader "behind" the Composer loader that can load
+| model classes on the fly, even if the autoload files have not been
+| regenerated for the application. We'll add it to the stack here.
+|
+*/
+
+Illuminate\Support\ClassLoader::register();
+
 /*
 /*
 |--------------------------------------------------------------------------
 |--------------------------------------------------------------------------
 | Register The Workbench Loaders
 | Register The Workbench Loaders