From 78dc4529f1d01fb438f6e41d817c25f8695ed417 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 6 Feb 2012 16:54:44 -0600 Subject: [PATCH] added routed array. --- laravel/bundle.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/laravel/bundle.php b/laravel/bundle.php index 4d3415a8..1be354b8 100644 --- a/laravel/bundle.php +++ b/laravel/bundle.php @@ -23,6 +23,13 @@ class Bundle { */ public static $started = array(); + /** + * All of the bundles that have their routes files loaded. + * + * @var array + */ + public static $routed = array(); + /** * Register a bundle for the application. * @@ -107,10 +114,14 @@ class Bundle { */ public static function routes($bundle) { - if (file_exists($path = static::path($bundle).'routes'.EXT)) + $path = static::path($bundle).'routes'.EXT; + + if ( ! static::routed($bundle) and file_exists($path)) { require $path; } + + static::$routed[] = $bundle; } /** @@ -155,6 +166,17 @@ class Bundle { return in_array(strtolower($bundle), static::$started); } + /** + * Determine if a given bundle has its routes file loaded. + * + * @param string $bundle + * @return void + */ + public static function routed($bundle) + { + return in_array(strtolower($bundle), static::$routed); + } + /** * Get the identifier prefix for the bundle. *