From 7af5afc4b5d6af58149dc0ca4c85451a142ba39a Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 30 Apr 2012 15:09:56 -0500 Subject: [PATCH] Allow starter Closure for bundles. --- laravel/bundle.php | 8 ++++++-- laravel/documentation/changes.md | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/laravel/bundle.php b/laravel/bundle.php index 32965390..7e93af4e 100644 --- a/laravel/bundle.php +++ b/laravel/bundle.php @@ -92,8 +92,12 @@ class Bundle { // Each bundle may have a start script which is responsible for preparing // 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; } diff --git a/laravel/documentation/changes.md b/laravel/documentation/changes.md index a33fd048..3fea5ab2 100644 --- a/laravel/documentation/changes.md +++ b/laravel/documentation/changes.md @@ -64,6 +64,7 @@ - Added `array_pluck` helper, similar to pluck method in Underscore.js. - Allow the registration of custom cache and session drivers. - 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. ## Upgrading From 3.1