Browse Source

Allow starter Closure for bundles.

Taylor Otwell 12 years ago
parent
commit
7af5afc4b5
2 changed files with 7 additions and 2 deletions
  1. 6 2
      laravel/bundle.php
  2. 1 0
      laravel/documentation/changes.md

+ 6 - 2
laravel/bundle.php

@@ -92,8 +92,12 @@ class Bundle {
 
 
 		// Each bundle may have a start script which is responsible for preparing
 		// Each bundle may have a start script which is responsible for preparing
 		// the bundle for use by the application. The start script may register
 		// the bundle for use by the application. The start script may register
-		// any classes the bundle uses with the auto-loader, etc.
-		if (file_exists($path = static::path($bundle).'start'.EXT))
+		// any classes the bundle uses with the auto-loader class, etc.
+		if ( ! is_null($starter = static::option($bundle, 'starter')))
+		{
+			$starter();
+		}
+		elseif (file_exists($path = static::path($bundle).'start'.EXT))
 		{
 		{
 			require $path;
 			require $path;
 		}
 		}

+ 1 - 0
laravel/documentation/changes.md

@@ -64,6 +64,7 @@
 - Added `array_pluck` helper, similar to pluck method in Underscore.js.
 - Added `array_pluck` helper, similar to pluck method in Underscore.js.
 - Allow the registration of custom cache and session drivers.
 - Allow the registration of custom cache and session drivers.
 - Allow the specification of a separate asset base URL for using CDNs.
 - Allow the specification of a separate asset base URL for using CDNs.
+- Allow a `starter` Closure to be defined in `bundles.php` to be run on Bundle::start.
 
 
 <a name="upgrade-3.2"></a>
 <a name="upgrade-3.2"></a>
 ## Upgrading From 3.1
 ## Upgrading From 3.1