Last active
May 4, 2016 10:07
-
-
Save wouldhide/09039580076e53b04dd7a9eb85d37b59 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// put snippet in app/Providers/AppServiceProvider boot method | |
Blade::extend(function ($value, $compiler) { | |
$value = preg_replace('/(?<=\s)@switch\((.*)\)(\s*)@case\((.*)\)(?=\s)/', '<?php switch($1):$2case $3: ?>', $value); | |
$value = preg_replace('/(?<=\s)@endswitch(?=\s)/', '<?php endswitch; ?>', $value); | |
$value = preg_replace('/(?<=\s)@case\((.*)\)(?=\s)/', '<?php case $1: ?>', $value); | |
$value = preg_replace('/(?<=\s)@default(?=\s)/', '<?php default: ?>', $value); | |
$value = preg_replace('/(?<=\s)@break(?=\s)/', '<?php break; ?>', $value); | |
return $value; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment