Last active
August 2, 2016 20:20
-
-
Save deyvisonrocha/ac307aef402fb6bed40e to your computer and use it in GitHub Desktop.
Create a extend command on Blade for Laravel 4.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
|-------------------------------------------------------------------------- | |
| Extend blade so we can define a variable | |
| <code> | |
| @define $variable = "whatever" | |
| </code> | |
|-------------------------------------------------------------------------- | |
*/ | |
Blade::extend(function($value) { | |
return preg_replace('/\@define(.+)/', '<?php ${1}; ?>', $value); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment