I have searched a lot regarding this topic and didn't find much on the web so I started to research and create a complete article on this topic but I am unable to understand some things here, making basic custom tags in blade is easy like
@search @endsearch or @title('something')
but what if I want to do something like below
- @cache('sidebar',10,[$silver,$gold,$platinum])
- html tags come here
- @endcache
At present I am doing it like this
- @cache('sidebar_',10,function() use ($silver_sidebar,$gold_sidebar))
-
- @endcache
-
- $pattern = Blade::createOpenMatcher('cache');
- $replace = "<?php echo PageCache::cache$2 { ?>";
- $view = preg_replace($pattern, $replace, $view);
-
- // Replace closing tag
- $view = str_replace('@endcache', '<?php }); ?>', $view);
How to parse it to separate three parameters and get content between end and start tag? Your help is appreciated. Thanks for your responses.