Skip to content

Commit eb59555

Browse files
committed
Merge pull request laravel#135 from raftalks/patch-4
Updated example of View Composer : Correction
2 parents 72a6764 + 5830005 commit eb59555

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

responses.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,18 @@ View composers are callbacks or class methods that are called when a view is cre
119119

120120
**Defining A View Composer**
121121

122-
View::composer('profile', function($event)
122+
View::composer('profile', function($view)
123123
{
124-
$event->view->with('count', User::count());
124+
$view->with('count', User::count());
125125
});
126126

127127
Now each time the `profile` view is created, the `count` data will be bound to the view.
128128

129129
You may also attach a view composer to multiple views at once:
130130

131-
View::composer(array('profile','dashboard'), function($event)
131+
View::composer(array('profile','dashboard'), function($view)
132132
{
133-
$event->view->with('count', User::count());
133+
$view->with('count', User::count());
134134
});
135135

136136
If you would rather use a class based composer, which will provide the benefits of being resolved through the application [IoC container](/docs/ioc), you may do so:
@@ -141,9 +141,9 @@ A view composer class should be defined like so:
141141

142142
class ProfileComposer {
143143

144-
public function compose($event)
144+
public function compose($view)
145145
{
146-
$event->view->with('count', User::count());
146+
$view->with('count', User::count());
147147
}
148148

149149
}

0 commit comments

Comments
 (0)