Where to place Blade::extend
laravel, laravel-blade, php
Solution
There's no requirement telling you where you should put the code, you could even put it in your `routes.php` (which is a bit messy of course). You only have to make sure that it's loaded when laravel processes a page view.
In this case, creating a new file `blade_extensions.php` somewhere and including it in `start/global.php` might be a good solution.
PS: Be sure to clear out your compiled views, as Blade only recompiles the views if it detects a change, so if you've just plonked in this code it won't work until you clear out the views.
Problem
I want to add the following code to my laravel project to support the break and continue statements in blade. This is the code: ``` Blade::extend(function($value) { return preg_replace('/(\s*)@(break|continue)(\s*)/', '$1<?php $2; ?>$3', $value); }); ``` I have no idea however where to place it, any help would be appreciated?