In laravel 4 I used to have HTML macros which were used in multiple views, like:
HTML::macro('minipics', function($pic)
{
//
}
For that I had a macros.php
file in the /app
folder. I could not find out where to put the macros in laravel 5. Should I use the 'macroable' feature for that?
edit:
I ended up using @include()
, giving it the needed values.
@include('shared.minipics', $mpics = $ppics)
@include('shared.minipics', $mpics = $randpics)
You can do it the same way as in Laravel 4.
Place your
macros.php
file in the/app
folder.Then in your
composer.json
you do thisI've moved my macros into a "resources/macros/..." directory because I think they belong with all of the other view related code. To load them I'm using a service provider which looks something like this: