I am writing a simple custom directive in Laravel. Whenever I make some changes in the code of custom directive, its not reflected in the view until I
- Comment the directive in view.
- Reload the page
- Uncomment the directive
- Reload the page to finally get the changes
Custom directive code in global.php
Blade::extend(function($value, $compiler)
{
$pattern = $compiler->createMatcher('molvi');
return preg_replace($pattern, '$1<?php echo ucwords($2); ?>', $value);
});
Directive call in view
@molvi('haji') //this will output 'Haji' due to ucwords($2)
//the ucwords() is replaced with strtolower()
@molvi('haji') //this will still output 'Haji'
I am converting the words to uppercase. When lets say I want to use strtolower()
instead of ucwords()
, I have to repeat above steps to get changes reflected.
UPDATE
I have tried to clear the cache with various methods as described in this thread but still no success.
UPDATE
Since no one is answering this question on StackOverFlow, I have posted it on laravel github.