Hi, I have a problem with creating a directive with two parameters where one is a variable
@php $icon = 'myIcon'; @endphp
@iconDir($icon, 'myClass')
because the first parameter for iconDir is a variable it doesn’t register in my directive
sage('blade')->compiler()->directive('iconDir', function ($expression) {
eval("\$params = [$expression];");
list($param1, $param2) = $params;
return '$param1: ' . $param1 .'<br /> $param2: '. $param2 . '<br /> $expression: ' . "<?= {$expression}; ?>";
});
the output for this is imply
$param1:
$param2: myClass
$expression: myIconmyClass
Could someone please tell me how to solve this problem?