custom blade directives
BladeHelper::directive('uppercase', function($expression) {
return "<?php echo strtoupper($expression); ?>";
});
// Define the helper directive BladeHelper::directive('uppercase', 'strtoupper'); // Use it in a view @uppercase('Hello world.') // Get the compiled result echo strtoupper('Hello world.'); // See what's echoed "HELLO WORLD."
https://github.com/imliam/laravel-blade-helper/blob/master/README.md
// Define the helper directive BladeHelper::directive('uppercase', 'strtoupper'); // Use it in a view @uppercase('Hello world.') // Get the compiled result echo strtoupper('Hello world.'); // See what's echoed "HELLO WORLD."
https://github.com/imliam/laravel-blade-helper/blob/master/README.md
Comments
Post a Comment