Browse Source

allow multiple views to be registered for a single composer.

Taylor Otwell 12 years ago
parent
commit
a150a7d457
1 changed files with 9 additions and 4 deletions
  1. 9 4
      laravel/view.php

+ 9 - 4
laravel/view.php

@@ -250,13 +250,18 @@ class View implements ArrayAccess {
 	 *		});
 	 * </code>
 	 *
-	 * @param  string   $view
-	 * @param  Closure  $composer
+	 * @param  string|array  $view
+	 * @param  Closure       $composer
 	 * @return void
 	 */
-	public static function composer($view, $composer)
+	public static function composer($views, $composer)
 	{
-		Event::listen("laravel.composing: {$view}", $composer);
+		$views = (array) $views;
+
+		foreach ($views as $view)
+		{
+			Event::listen("laravel.composing: {$view}", $composer);
+		}
 	}
 
 	/**