Add better documentation to composers.php
This commit is contained in:
parent
513c9c75a1
commit
5b75546e7e
|
@ -8,21 +8,34 @@
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Named views give you beautiful syntax when working with your views.
|
| Named views give you beautiful syntax when working with your views.
|
||||||
| After you have defined a name for a view, you can create an instance of
|
|
|
||||||
| that view using the expressive View::of dynamic method:
|
| Here's how to define a named view:
|
||||||
|
|
|
||||||
|
| 'home.index' => array('name' => 'home')
|
||||||
|
|
|
||||||
|
| Now, you can create an instance of that view using the expressive View::of
|
||||||
|
| dynamic method. Take a look at this example:
|
||||||
|
|
|
|
||||||
| return View::of_layout();
|
| return View::of_layout();
|
||||||
|
|
|
|
||||||
| For more information, check out: http://laravel.com/docs/start/views#named-views
|
|
||||||
|
|
|
||||||
| View composers provide a convenient way to add common elements to a view
|
| View composers provide a convenient way to add common elements to a view
|
||||||
| each time it is created. For example, you may wish to bind a header and
|
| each time it is created. For example, you may wish to bind a header and
|
||||||
| footer partial each time the view is created.
|
| footer partial each time the view is created.
|
||||||
|
|
|
|
||||||
| The composer will receive an instance of the view being created, and is
|
| The composer will receive an instance of the view being created, and is
|
||||||
| free to modify the view however you wish.
|
| free to modify the view however you wish. Here is how to define one:
|
||||||
|
|
|
|
||||||
| For more information, check out: http://laravel.com/docs/start/views#composers
|
| 'home.index' => function($view)
|
||||||
|
| {
|
||||||
|
| //
|
||||||
|
| }
|
||||||
|
|
|
||||||
|
| Of course, you may define a view name and a composer for a single view:
|
||||||
|
|
|
||||||
|
| 'home.index' => array('name' => 'home', function($view)
|
||||||
|
| {
|
||||||
|
| //
|
||||||
|
| })
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue