imanghafoori1/laravel-widgetize

I need something like WidgetWhen(Condition,WidgetView)

mma56k opened this issue · 4 comments

I need something like WidgetWhen(Condition,WidgetView)
Yahav commented

Ohh, that's a really good idea 👍

Yahav commented

Perhaps something like this:

Blade::directive('widgetWhen', function ($conditionResult, $expression) use ($omitParenthesis) {
if ($conditionResult===true) {
$expression = $omitParenthesis ? $expression : "($expression)";
return "renderWidget{$expression}; ?>";
}
else {
return "";
}
});

thanks a lot.
but i suggest something more simple
to reduce lines of code

stay away from it