I am trying to use the argument passed in the directive to calculate the condition and return a string like this
Blade::directive('resource', function($page) {
return (strcmp(URL::full(), URL::to("/admin/" + $page)) == 0) ? "active" : "inactive";
});
If the page name that has passed into the field is evaluated to the full URL, then it returns the active string, otherwise return inactive. For styling
The problem is that $ page evaluates (value), where value is the string passed inside. Can I use this argument to calculate conditions here?
The closest post I could find is Using the Blade directive in the Blade directive , but no answer.
thank
source
share